Unable to get a hold of temp file on PHP file upload
Posted on 2009-05-19
After uploading a file to my server, I can't get a hold of it with the move_uploaded_file() function.
If I do a print_f($_FILES) after the upload, I get the following:
[FileUpload1_File] => Array
[name] => cat_lvl1_default_banner.gif
[type] => image/gif
[tmp_name] => C:\apps\temp_file_upload\phpFE5F.tmp
[error] => 0
[size] => 15281
So it seems the upload was successful, no errors (0), and the temp file should be in "C:\apps\temp_file_upload\phpFE5F.tmp", but when I use:
it fails. To debug, I check for is_writable([$new_location directory here]) and it is fine, I was also able to create a new file in this location manually by doing touch($new_location), so $new_location don't seem to be the problem.
In the other hand, when I tried is_uploaded_file($_FILES['FileUpload1_File']['tmp_name']) I get a false. So for some reason the file is "missing" from its temp location. This temp location folder has the permission set to be writable by all users, so I really don't know why the temp file is not there, or is not accessible to the is_uploaded_file() command.
I also tried copy($_FILES['FileUpload1_File']['tmp_name'], $new_location) instead of move_uploaded_file(), but I get the following error:
copy(C:\apps\temp_file_upload\phpC221.tmp) [function.copy]: failed to open stream: No such file or directory
I'm thinking this is a Windows Vista issue, I'll try in a linux box, but does anybody know how can I fix this?