Oli
Oli

Reputation: 2464

Temp dir in php.ini not working?

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?

Upvotes: 1

Views: 286

Answers (1)

egig
egig

Reputation: 4430

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.

Upvotes: 1

Related Questions