PHP:move_upload_file不工作(PHP: move_upload_file not

2019-10-29 14:49发布

我有一个名为team1-> uploads-> upload_file.php文件夹。 upload_file.php上传文件,但必须把它放在上传目录,所以我是用../上去的文件夹。 文件权限是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

有人知道怎么修这个东西吗? 有另一种方式来上传文件?

Answer 1:

设置权限为777的上传文件夹,你可以直接在文件夹或使用PHP的:

chmod("../uploads/", 777);


文章来源: PHP: move_upload_file not working