我有一个表格,可以让用户上传自己的照片。这似乎有效。上传后,照片确实存在于服务器上。当我尝试访问该文件时,我收到“403 禁止 - 您无权访问此服务器上的此 url”,并且我收到“此外,在尝试使用 ErrorDocument 处理时遇到 410 Gone 错误要求。”
这是我上传图片的代码。
$target_path = "images/";
$target_path = $target_path . basename( $_FILES['uploadpic']['name']);
if(move_uploaded_file($_FILES['uploadpic']['tmp_name'], $target_path))
{
echo "The file ". basename( $_FILES['uploadpic']['name']). " has been uploaded";
}
else
{
echo "There was an error uploading the file, please try again!";
}