我有此代码
if(isset($_POST["submit"])) {
$target_dir = $_SERVER['DOCUMENT_ROOT']."/datapneu/public/";
$target_file = $target_dir . basename($_FILES["pricat"]["name"]);
if (move_uploaded_file($_FILES["pricat"]["tmp_name"], $target_file)) {
echo "The file ". basename( $_FILES["pricat"]["name"]). " has been uploaded.";exit;
} else {
echo "Sorry, there was an error uploading your file.";exit;
}
}
和我在服务器上的所有目录都具有755权限 仍然不起作用
答案 0 :(得分:-1)
您应尝试获得777许可。另外,请确保目录路径确实存在并且已正确传递(我的意思是目录分隔符'\'或'/'取决于服务器)。