Page 1 of 1

Upload problem: missing temporal file

Posted: Mon Apr 16, 2012 1:28 pm
by hbadino
Hi,

I'm trying to upload a file using the following form:

Code: Select all

<form action="insert_video.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
File: <input type="file" name="file" id="idfile" />
<input type="submit" />
</form>
Now, in the insert_video.php file I would like to move the uploaded file from the temporal location to a new one. The problem is that the temporal file does not exist and move_uploaded_file fails. No errors are reported either. I get this output:

[text]Return Code: 0
File /tmp/phpxEOZc9 does not exist!
[/text]

using this code:

Code: Select all

<?php

echo "Return Code: " . $_FILES["file"]["error"] . "<br />";

if (file_exists($_FILES["file"]["tmp_name"]))
    echo "File " . $_FILES["file"]["tmp_name"] . " does not exist!";
else
    echo "File " . $_FILES["file"]["tmp_name"] . " do exist!";

?>
I can confirm that the file /tmp/phpxEOZc9 is not created. /tmp has mode 777.

My upload php ini parameters are the following:

[text]file_uploads On
max_file_uploads 20
upload_max_filesize 1600M
upload_tmp_dir /tmp
[/text]

I've found several posts in different forums about this same issue with no solution at all.

My php version is 5.3.6-13ubuntu3.6

Has anyone an idea what's wrong with my code or configuration?

Re: Upload problem: missing temporal file

Posted: Mon Apr 16, 2012 3:39 pm
by hbadino
Problem solved. The code I wrote before should have read

Code: Select all

if (!file_exists($_FILES["file"]["tmp_name"]))
instead of

Code: Select all

if (file_exists($_FILES["file"]["tmp_name"]))