Changing PHP Temp Directory

余生颓废 提交于 2019-12-07 03:42:27

PHP is ignoring the upload_tmp_dir because of one setting on APPLICATION POOLS. It's not php-cgi.exe nor php.ini or a permissions issue. Go to the application pool of the website experiencing the issue: 1. right click 2. select advanced settings 3. scroll to LOAD USER PROFILE and set it to FALSE.

that did the trick for me.

This is less of a problem solved and more of a workaround. The issue seems to be something with the $_FILES['file']['tmp_name'];

When I echo the contents it looks as I expect however no file appears. So rather than taking advantage of that process that happens naturally, I have had to take a manual approach. What I have done is the following:

create a temp file

$temp_file = tempnam(ini_get('upload_tmp_dir'), 'php');

then add the content from the temp file created during the $_POST request. (which some how are in the $_FILES variable even though the file is not when I look in the directory)

file_put_contents($temp_file, file_get_contents($_FILES['file']['tmp_name']));

the I have my temporary file for processing.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!