I am running WAMP server. On file upload using PHP I see
$_FILES[tmp_name] => string 'C:\wamp\tmp\phpD382.tmp' (length=23)
I go to that folder and it's empty. I made sure my 'show hidden files' is on from my 'folders option' but I don't see it. Where is it exactly?
Besides when does it get deleted? If I don't move that file? For an instance if I'm uploading a file and the file uploaded halfway and I decided to close that browser what happens to the file? When does the server know to delete that temp file?
As soon as your PHP script finishes executing and re-saving to the defined location
Example using straight PHP, no framework
http://www.php.net/manual/en/features.file-upload.post-method.php
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
If you do not do anything with them they will be deleted right after the script is finished.
If deleting file is not desired, i found that PHP wont delete file after execution if you "move" it to same location.
move_uploaded_file($temporaryFile, $temporaryFile);