Where does PHP save temporary files during uploading?

前端 未结 8 1416
情书的邮戳
情书的邮戳 2021-02-07 05:50

I am using XAMPP on Windows. By printing $_FILES[\"file\"][\"tmp_name\"], it seems that the temporary file was saved at C:\\xampp\\tmp\\phpABCD.tmp. But I cannot se

相关标签:
8条回答
  • 2021-02-07 06:16

    php stores all temporary files, that includes uploaded files, in the temporary files directory as specified in the php.ini. Note that for uploads, those files might be removed as soon as the script the file was uploaded to was terminated (so unless you delay that script, you probably won't see the uploaded file). Another reason might be that the file is simply hidden on the file system.

    So if you want to see the file, you might want to make sure you see all hidden files in the explorer and delay the script as long as you need to find the file.

    0 讨论(0)
  • 2021-02-07 06:18

    You can check where php is currently saving your temp files $_FILES["file"]["tmp_name"] by printing

        sys_get_temp_dir()
    
    0 讨论(0)
  • 2021-02-07 06:20

    Its specified in upload_tmp_dir in your php.ini file. It is deleted by the system automatically after use.

    0 讨论(0)
  • 2021-02-07 06:23

    from http://www.php.net/manual/en/features.file-upload.php#93602, "...the uploaded file will inherit the permissions of the directory specified in the directive upload_tmp_dir of php.ini. If this directive isn't set, the default of C:\Windows\Temp is used..."

    0 讨论(0)
  • 2021-02-07 06:31

    IF you are asking the file location then it depend on the setting of server. but if you are asking whether it saved first in local system or in server. then answer is it save in temp folder in server.

    0 讨论(0)
  • 2021-02-07 06:35

    It saves it at the path specified in $_FILES["file"]["tmp_name"], but deletes it after the script is done executing. It's up to you to move the file elsewhere if you want to preserve it.

    0 讨论(0)
提交回复
热议问题