Change default temp directory for PHP file uploads

2019-04-26 09:24发布

问题:

I'm making a website locally that allows the upload of .pdf files, when these are uploaded locally they go to C:\xampp\tmp but when I host the site on my University server I don't have access to the temporary directory, is there any way I can change the default temporary location for the file?

Thanks in advance, Dave.

回答1:

The location where uploaded files land can be configured using the upload_tmp_dir configuration option.



回答2:

Try this.

putenv('TMPDIR=/path/to/dir');

than you can check your tmp directory

sys_get_temp_dir()


回答3:

I do not believe that you had no right of access to the temp directory. In temp directory are stored session data.

You should check temp direcory using:

sys_get_temp_dir()