PHP图片上传麻烦

Gre*_*tra 0 php joomla image-uploading

我目前正在做一个Joomla!网站.我正在使用Jumi扩展(允许在Joomla!本身内制作和执行自定义脚本)来创建一个简单的文件上传工具.问题是我收到以下错误:

警告:复制(C:/xampp/htdocs/images/1253889508.jpg)[function.copy]:无法打开流:C:\ xampp\htdocs\Joomla\components\com_jumi\jumi.php中没有此类文件或目录(25):第61行的eval()代码

违规代码如下:

//we will give an unique name, for example the time in unix time format
$image_name=time().'.'.$extension;
//the new name will be containing the full path where will be stored (images folder)
$newname='C:/xampp/htdocs/images/'.$image_name;
//we verify if the image has been uploaded, and print error instead
$copied = copy($_FILES['image']['tmp_name'], $newname);
Run Code Online (Sandbox Code Playgroud)

完整代码可在此处获得.一旦我开始工作,我将修改它以满足我的网站的需求.

我不确定问题是否是Jumi的权限问题,或者是否存在其他问题.我能说的最好的是,无论出于何种原因,都没有创建临时文件.

感谢您提供的任何提示!

ink*_*dmn 6

试试这个:

if(move_uploaded_file($_FILES['image']['tmp_name'], $newname)){
    // move worked, carry on
}
Run Code Online (Sandbox Code Playgroud)

并使用相对路径而不是绝对路径.