If you encounter php5.6 upload pictures or error code 6 error "PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0" How to solve

Question: reuse webuploader upload pictures when found error, print the $ _FILES [ "file"] [ "error"] found to be 6, Missing a temporary folder;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$_FILES['file']['error']有以下几种类型:
 
1、UPLOAD_ERR_OK
其值为 0,没有错误发生,文件上传成功。
  
2、UPLOAD_ERR_INI_SIZE
其值为 1,上传的文件超过了 php.ini 中 upload_max_filesize选项限制的值。
  
3、UPLOAD_ERR_FORM_SIZE
其值为 2,上传文件的大小超过了 HTML 表单中 MAX_FILE_SIZE 选项指定的值。
  
4、UPLOAD_ERR_PARTIAL
其值为 3,文件只有部分被上传。
  
5、UPLOAD_ERR_NO_FILE
其值为 4,没有文件被上传。
  
6、UPLOAD_ERR_NO_TMP_DIR
其值为 6,找不到临时文件夹。PHP 4.3.10 和 PHP 5.0.3 引进。
  
7、UPLOAD_ERR_CANT_WRITE
其值为 7,文件写入失败。PHP 5.1.0 引进。

 solution:

1, look at PHP's php.ini is set in the temporary folder, the upload_tmp_dir php.ini option. (There are no comments, there is no provision of temporary files) 

2, if you have set up a temporary file, then see the permissions have not read and write permissions

  Linux: chmod -R 0777 /tmp

  Windows: Set C: / temp directory permissions everyone can read and write.

3, restart apache server

sudo apachectl restart;

 

Well, this should be no problem!

Guess you like

Origin www.cnblogs.com/qtffg/p/11465193.html