gpt4 book ai didi

PHP/IIS copy()/move_uploaded_file() 无法打开流 : Permission denied Warning

转载 作者:可可西里 更新时间:2023-10-31 22:10:58 24 4
gpt4 key购买 nike

我是网络开发的新手,目前遇到了一个我无法解决的错误。

输入“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 运行本地主机。预先感谢您帮助我!!

最佳答案

在我的情况下,IUSR 帐户需要目标目录中的权限。不是 ISS_IUSR 帐户,只是 IUSR 帐户。

关于PHP/IIS copy()/move_uploaded_file() 无法打开流 : Permission denied Warning,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29127789/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com