Using PHP to upload files, there are no problems in the development environment, upload to the online environment encountered some problems, mainly relatively large files will have problems.
The following problems were encountered:
Error 1: $_FILES variable fetch file content error=1.
[the 2019-11-21 10:50:50] {"name":"86Resource.zip"."type":""."tmp_name":""."error": 1,"size": 0}Copy the code
Refer to the manual for information about the error code:
The value of UPLOAD_ERR_INI_SIZE is 1. The uploaded file exceeded the limit of upload_max_filesize in php.ini.Copy the code
Solution:
Change the value of upload_max_filesize in php.ini to a larger value.Copy the code
Ps: Available
php --ini
Copy the code
Command to view the path of the current loaded configuration file.
Problem 2: The $_FILES variable is empty
I checked online and found that another parameter setting was too small. Solution:
Change the post_max_size option in php.ini to a larger value.Copy the code
Question 3:423 Request Entity Too Large
Solutions:
Set client_max_body_size in nginx.conf to a larger value.Copy the code
Ps: But I don’t know why I set 8 megabytes, I can also send 12 megabytes, no error. Still to be studied.