Stuck with Uploading a file

software development

#1

I’ve read many threads with the same problem, but none of the solutions given have helped me to solve my problem.

For one of my domains I followed the wiki instructions from dreamhost to set a custom php.ini and the upload_tmp_dir is set to /home/myusername/tmp,
this folder also has permissions set to 777.
The problem is that when an jpeg image is uploaded using this html form, I can’t find the file uploaded to my temp folder.

I’ve tested this on another domain without a custom php.ini and disabling the extra security feature from the webpanel.
the default temp folder is /tmp (0777) and I can’t see the source file that has been uploaded.
Can you help me to detect where I’m missing something.

[php]
error_reporting(E_ALL);
ini_set(‘display_errors’,‘On’);
$currentDir = dirname(FILE);

if(isset($_POST['submit'])) {
	if(!empty($_FILES)) {
        echo $_FILES['fileme']['tmp_name']."<br />";
        echo is_uploaded_file($_FILES['fileme']['tmp_name'])."<br />";
        print_r($_FILES);
	  }
    echo file_exists($_FILES['fileme']['tmp_name'])."<br />";
    $tmpName = tempnam($currentDir."/img/tmp/","PS");
    echo move_uploaded_file($_FILES['fileme']['tmp_name'], $tmpName);
    print_r(getimagesize($tmpName));

}

[/php]

Thanks in advance.

When I print the $_FILES I got this.
Array (
[fileme] =>
Array (
[name] => 12-02-10-108.jpg
[type] => application/octet-stream
[tmp_name] => /home/myusername/tmp/phpSg95Hm
[error] => 0
[size] => 0
)
)

Notice that there is no error, however the size is 0 after the html form has been uploaded.
Also, I got the same message in my other domain, though, the tmp_name is related to the /tmp folder


#2

After some hours, I solved this problem, in the end, it was a faulty browser Firefox that wasn’t uploading files or downloading files.(settings were messed up)
I tested with other browsers like chrome and everything worked fine.