PHP File Upload, files disappearing from /tmp before move_uploaded_files

前端 未结 14 1990
独厮守ぢ
独厮守ぢ 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:20

    You are using the return value of move_uploaded_file() the wrong way round:

    if(move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_file))
    {
        $result['error'] = 'true';
    }
    else
    {
        $result['error'] = 'false';
        $result['file_loc'] = $upload_file;
    }
    

提交回复
热议问题