我有一个名为team1-> uploads-> upload_file.php文件的文件夹。 upload_file.php上传文件,但必须将其放在uploads目录中,所以我使用../来上传文件夹。文件权限是700.我有
move_uploaded_file($_FILES["file"]["tmp_name"],
"../uploads/".$_FILES["file"]["name"]);
我收到以下错误:
Warning: move_uploaded_file(../uploads/profile.jpg): failed to open stream: Permission denied in D:\inetpub\wwwroot\vhosts\cs5339\team1\Produce\upload_file.php on line 31 Warning: move_uploaded_file(): Unable to move 'C:\Windows\Temp\php938F.tmp' to '../uploads/profile.jpg' in D:\inetpub\wwwroot\vhosts\cs5339\team1\Produce\upload_file.php on line 31 registered
任何人都知道如何解决这个问题?还有另一种上传文件的方法吗?
答案 0 :(得分:0)
在uploads文件夹上设置权限为777,你可以直接在文件夹上或使用php执行:
chmod("../uploads/", 777);