Magic
Magic

Reputation: 1196

PHP upload file success but the temp file is missing

I follow the php.net of File upload(http://www.php.net/manual/en/features.file-upload.post-method.php) to implement file upload. It seems OK but I can't found the temp file.

Below is the $_FILES debug info

array(1) { ["userfile"]=> array(5) 
{ ["name"]=> string(14) "driver_win.csv" 
["type"]=> string(8) "text/csv" 
["tmp_name"]=> string(25) "/tmp/php_upload/phpzdeKnp" 
["error"]=> int(0) 
["size"]=> int(29952) } }

You can see the error is 0 and I've chmod 777 to "/tmp/php_upload" directory.
I confirm that this directory is writeable.
PHP is_writable() and file_put_contents() show that this directory is writeable.

And it's not the size limit problem. The size is just 30K. My php.ini config is 2M and apache post 8M.

But I can't found any temp file.

Upvotes: 1

Views: 1706

Answers (1)

Quentin
Quentin

Reputation: 944205

The file will be deleted when the script finishes. You need to process it (e.g. copy it somewhere) inside the PHP script if you want to preserve it.

Upvotes: 4

Related Questions