PHP Warning: File upload error

 代码在本地运行一切都OK,放到服务器上,网站访问正常,上传就出现该错误。

提示:PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0

出现问题的服务器:Windows server 2012 Standard

iis8 php5.5.37 fastCGI

原因:原来是在配置php环境的时候,php.ini没有设置upload_tmp_dir 。

如果 php.ini 没有设置 upload_tmp_dir,那么默认 php 进程会读写系统的临时目录(Windows 默认为 C:/windows/temp,Linux 为 /tmp),所以为了保险起见还是设置下这个值。

解决:将upload_tmp_dir 的路径制定到项目中存放上传文件的文件夹中。

原文地址:https://www.cnblogs.com/Darlin356230410/p/5695899.html