当我尝试上传文件时,此 php 脚本正在重新调整错误。我在 win xp 机器上使用 XAMPP。我相信我已经正确设置了共享权限。
剧本:
//For images
if (isset($_FILES['image300x100']) && !empty($_FILES['image300x100']['tmp_name'])) {
$name = $_FILES['image300x100']['name']; // getting the name of the file
$tempName = $_FILES['image300x100']['tmp_name']; // getting the temporary file name.
$allowedExt = array('jpg', 'jpeg', 'png', 'gif' );// specifying the allowed extentions
$a = explode('.', $name);
$fileExt = strtolower(end($a)); unset($a);//
$fileSize = $_FILES['image300x100']['size'];
$filePath = "";
switch($category){
case 1 : $filePath = "c:/www/Perspect/categories/politics/articleImages"; break;
//etc etc etc
}
$path = $filePath;
} else{
$errors[] = 'no file selected';
}
$moveResult = move_uploaded_file($tempName, $filePath);
保持原样,错误是:
Warning: move_uploaded_file(): The second argument to copy() function cannot be a directory in C:\www\Dev\admin\addNewArticle.php on line 62
Warning: move_uploaded_file(): Unable to move 'C:\Server\XAMPP\tmp\php62C.tmp' to 'c:/www/Dev/categories/bla/articleImages' in C:\www\Dev\admin\addNewArticle.php on line 62
我c:/
从我认为是正确路径的路径中删除了,但结果如下:
temp nameC:\Server\XAMPP\tmp\php62E.tmp filepath
www/Dev/categories/bla/articleImages
Warning: move_uploaded_file(www/Dev/categories/bla/articleImages): failed to open stream: No such file or directory in C:\www\Dev\admin\addNewArticle.php on line 62
Warning: move_uploaded_file(): Unable to move 'C:\Server\XAMPP\tmp\php62E.tmp' to 'www/Dev/categories/bla/articleImages' in C:\www\Dev\admin\addNewArticle.php on line 62
非常感谢任何帮助