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 cannot find the tmp file in the tmp folder. But I KNOW that it is being put there, but is removed before move_upload_file()
can deal with it in my script. I know it is being put there since I can see a file in there when a large file is being posted to the server.
Also $_FILES
contains correct details for the file I have just uploaded.
Had anyone have any idea why the temporary file is being removed from /tmp before I have a chance to handle it?
Here is the basic code that I am using.
if(move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_file))
{
$result['error'] = 'false';
$result['file_loc'] = $upload_file;
}
else
{
$result['error'] = 'true';
}
The output of print_r($_FILES)
looks like
[userfile] => Array
(
[name] => switchsolo.png
[type] => image/png
[tmp_name] => /tmp/phpIyKRl5
[error] => 0
[size] => 6690
)
But /tmp/phpIyKRl5 simply isn't there.
1) Are the post_max_size and upload_max_filesize holding higher value than the size of the file you are trying to upload?
2) Does your uploading script take longer time to execute than the value of the max_execution_time variable allows?
3) I assume your uploading script doesn't consume as much memory as the memory_limit variable allows. When the client is uploading the file to the server, then the server is probably holding some of it in memory while doing so. I'm not sure if it somehow affects the limit of the memory_limit variable in php.ini.
These variables can be changed in php.ini and/or .htaccess or with ini_set().
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With