.htaccess :: Cannot set a upload_tmp_dir

Steve von Johnson picture Steve von Johnson · Dec 22, 2014 · Viewed 8.8k times · Source

Looks like a very simple task but it's not working... I'm trying to set upload_tmp_dir to the ROOT directory on my .htaccess file...

php_value upload_tmp_dir /

I'm printing out the results and it's stays the same as the default on my php.ini

echo 'Your Temp Upload Directory : '.ini_get('upload_tmp_dir').'<br>';

IOW... not working.

I know that it's impossible to set it via :

ini_set('upload_tmp_dir','/');

What am I doing wrong here ?

Answer

donald123 picture donald123 · Dec 22, 2014

The temporary directory used for storing files when doing file upload. Must be writable by whatever > user PHP is running as. If not specified PHP will use the system's default.

If the directory specified here is not writable, PHP falls back to the system default temporary directory. If open_basedir is on, then the system default directory must be allowed for an upload to succeed.

as you can see on ini.upload-tmp-dir

So check if open_basdir is on and new directory is writeable (which i think will not be writable you set it to root