PHP File Upload, files disappearing from /tmp before move_uploaded_files

前端 未结 14 1996
独厮守ぢ
独厮守ぢ 2021-02-13 03:09

I have a very basic upload script, probably lifted straight off the php.net/move_upload_files function page.

move_uploaded_file() is failed because it canno

14条回答
  •  广开言路
    2021-02-13 03:13

    Simple test to do right before the move_uploaded_file() function:

    if (!file_exists("upload")) {
      if (mkdir("upload")) {
        echo "Upload directory created!";
      }
      else {
        die( "Invalid upload directory!" );
      }
    }
    move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
    

提交回复
热议问题