繁体   English   中英

从Yahoo服务器上的网站上载图像文件时,尝试访问它时会导致410消失错误消息

[英]Uploading image file from website on yahoo server causes 410 gone error message when trying to access it

我有一个表格,可以让用户上传自己的照片。 这似乎有效。 上传后,照片确实存在于服务器上。 当我尝试访问文件时,我收到“ 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!";
 }

chmod()用于类似Unix的系统。

警告您的脚本将无条件覆盖目标文件。 也许这就是您想要的,但是请考虑如果$ target_path可通过网络访问并且恶意者上载了新的“ index.php”或其他内容,该怎么办。

您必须检查目标路径的配置:

禁止403->您无权进入该目录...

您需要更改该目录的chmod ...

410 Gone error -> The server couldn't found the proper error document to present with the 403 forbidden message (at htaccess you can set this up)

如果您不想要此消息,则需要创建一个自定义消息...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM