Change default temp directory for PHP file uploads

2019-04-26 09:15发布

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.

3条回答
时光不老,我们不散
2楼-- · 2019-04-26 09:36

Try this.

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

than you can check your tmp directory

sys_get_temp_dir()
查看更多
爷、活的狠高调
3楼-- · 2019-04-26 09:39

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

查看更多
成全新的幸福
4楼-- · 2019-04-26 09:41

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()
查看更多
登录 后发表回答