【发布时间】:2015-05-21 13:48:52
【问题描述】:
我对 Web 开发比较陌生,目前遇到了一个我无法解决的错误。
我在输入“http://localhost/index.html”并选择要上传的示例文件后使用 IIS 测试我的 php,它会生成以下警告:
Warning: move_uploaded_file(upload/Angela_Nie_resume_technical - EditedMW.doc): failed to open stream: Permission denied in C:\inetpub\wwwroot\test.php on line 26
Warning: move_uploaded_file(): Unable to move 'C:\Windows\Temp\php74F2.tmp' to 'upload/Angela_Nie_resume_technical - EditedMW.doc' in C:\inetpub\wwwroot\test.php on line 26
以下是与移动我的文件相关的代码。
$target_dir = "upload/";
$target_file = $target_dir . basename( $_FILES["uploaded"]["name"]) ;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target_file)) {
echo "The file has been uploaded";
}
else {
echo "Sorry, there was a problem uploading file.";
}
我正在使用 Windows 8.1 并使用 IIS 来运行 localhost。提前感谢您帮助我!
【问题讨论】:
标签: php iis file-upload warnings file-permissions