我在这里查看了与此类似的问题,但似乎没有一个对我有用,我的代码没有将文件上传到新目录。它只返回设置错误“文件无法上传”请帮助
if ($_FILES["imgfile"]["type"] == "image/jpeg")
{
if ($_FILES["imgfile"]["error"] > 0)
{
echo "Error: " . $_FILES["imgfile"]["error"] . "<br />";
}
else
{
move_uploaded_file($_FILES["imgfile"]["tmp_name"],
"upload/" . $_FILES["imgfile"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["imgfile"]["name"];
echo "<br> File uploaded successfully.";
}
}
else
{
echo "File could not be uploaded.";
}