【问题标题】:Unable to upload image despite successful submission via HTML form尽管通过 HTML 表单成功提交,但无法上传图片
【发布时间】:2016-10-08 10:29:59
【问题描述】:

我有一个托管在 Plesk(Godaddy 的 Windows 托管服务器)上的自定义 PHP 网站

当我提交表单时,所有值都会更新,但图像不会更新。这是页面上显示的错误

PHP Warning: move_uploaded_file(../../../uploads/channels/3.jpg): failed to open stream: 
Permission denied in G:\PleskVhosts\dramatainment.com\httpdocs\dashboard\admin\actions\update_queries.php on line 50
PHP Warning: move_uploaded_file(): Unable to move 'C:\Windows\Temp\php5E2E.tmp' to '../../../uploads/channels/3.jpg' in G:\PleskVhosts\dramatainment.com\httpdocs\dashboard\admin\actions\update_queries.php on line 50

我正在使用从 w3schools.com 获得的代码,这里是该脚本的链接 http://www.w3schools.com/php/php_file_upload.asp

任何帮助将不胜感激。

【问题讨论】:

  • 您似乎正在尝试写入某个位置,但当前用户不允许您写入。
  • 是的,您必须为文件上传文件夹授予 755 权限
  • 我该怎么做?你能告诉我吗
  • 这是我单击更改权限链接时收到的错误内部错误:filemng failed: Unable to get the object (G:\PleskVhosts\dramatainment.com\uploads) 安全信息:(2 ) 该系统找不到指定的文件。在执行 "C:\Program Files (x86)\Parallels\Plesk\admin\bin\filemng.exe" UmerAtiq --permissions --list-common "--file=G:\PleskVhosts\dramatainment.com\uploads" " --accounts=tmpCF93.tmp"(RunTime::RunAsUser::run 第 221 行) (错误代码 1)

标签: php html forms file-upload image-uploading


【解决方案1】:

为您要将图像文件移动到的目标文件夹授予写入权限。

【讨论】:

  • 如果您使用的是基于 linux 的服务器,那么应​​该是这样的: sudo chmod 755 directory_name 但在我看来,最好咨询服务器管理员。
  • 我正在使用 Godaddy Windows 托管。现在我知道如何改变它了。但这是我点击链接更改权限时得到的错误
  • 这是我单击更改权限链接时收到的错误内部错误:filemng failed: Unable to get the object (G:\PleskVhosts\dramatainment.com\uploads) 安全信息:(2 ) 该系统找不到指定的文件。在执行 "C:\Program Files (x86)\Parallels\Plesk\admin\bin\filemng.exe" UmerAtiq --permissions --list-common "--file=G:\PleskVhosts\dramatainment.com\uploads" " --accounts=tmpCF93.tmp"(RunTime::RunAsUser::run 第 221 行) (错误代码 1)
猜你喜欢
  • 2020-06-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-06-22
  • 1970-01-01
相关资源
最近更新 更多