$fileName = $_FILES["product-image"]["name"];
$pathAndName = "../productimage/Large/".$fileName;
$moveResult = move_uploaded_file($_FILES["product-image"]["tmp_name"] , $pathAndName);
if ($moveResult) {
echo "File has been moved from " . $_FILES["product-image"]["tmp_name"] . " to " . $pathAndName;
exit();
} else {
echo "ERROR: File not moved correctly from" . $_FILES["product-image"]["tmp_name"] . " to " . $pathAndName;
exit();
}
答案 0 :(得分:0)
您能否确认目标文件夹(../ productimage / Large /)具有正确的写入权限(777)?
我担心目标文件夹没有正确的权限。
答案 1 :(得分:0)
试试这段代码:
$fileName = $_FILES["product-image"]["name"];
$pathName = "../productimage/Large/";
$moveResult = move_uploaded_file($fileName , $pathName/$fileName);
if(is_writable($pathName)){ ///// verify directory chmod 777
if ($moveResult) {
echo "File has been moved from " . $fileName . " to " . $pathName; exit();
}else {
echo "ERROR: File not moved correctly from" . $fileName . " to " . $pathName; exit();
}
}else{
exit("Failed to write to directory $save_directory");
}