1

I have the following script:

<form method=post enctype="multipart/form-data">
<input type=file name=test><input type=submit></form>
<?php
echo sys_get_temp_dir();
echo '<br/>';
echo ini_get('upload_tmp_dir');
echo '<br/><pre>';
print_r($_FILES);
echo '</pre>';

This is the output:

/var/tmp/
/opt/httpd/tmp
Array
(
     [test] => Array
     (
        [name] => the-doors-logo.jpg
        [type] => image/jpeg
        [tmp_name] => /tmp/phpyeE7CX
        [error] => 0
        [size] => 80635
    )
)

In PHP.ini the tmp_upload_dir is set to '/opt/httpd/tmp'.

Can anyone explain to me how PHP can give me two different 'tmp' folders, while the tmp_name in my FILES is still in /tmp?

Oli
  • 2,370
  • 2
  • 26
  • 42
  • more info in the answer here as well: http://stackoverflow.com/questions/12531408/setting-php-tmp-dir-php-upload-not-working – user1914292 May 14 '13 at 07:37
  • 1
    I've checked all items on the checklist, but nothing has changed so far..I'll debug some more. – Oli May 14 '13 at 09:23

1 Answers1

1

It's because upload_temp_dir have been specified in your php.ini, php will use this, unless it is not specified, not exist or unwritable, php will use default system temp dir.

egig
  • 4,370
  • 5
  • 29
  • 50