Home >Backend Development >PHP Tutorial >PHP upload file size limit problem post_max_size impact on size and solution std size t header file size header file java file siz

PHP upload file size limit problem post_max_size impact on size and solution std size t header file size header file java file siz

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 08:52:371420browse

Today I discovered a problem when operating PHP upload. That is, when the file size uploaded by PHP script exceeds the limit of post_max_size in php.ini, the page will not give a reminder and the file will also fail to upload. This problem seems to be An alternative, I would like to share it with you today.

php.ini configuration parameters that affect the size of php upload files are:
Configuration items Possible values ​​Function description
file_uploads                                                                                                                                                                                                                                                                     Amount to prevent runaway scripts from monopolizing server memory
           
upload_max_filesize                                                                                                                            8M Limits the maximum amount of information that can be accepted through the POST method And the error in the corresponding $_FILES The corresponding error messages are:

Errors generated during file upload
                                                                                                                                                                                                                          2: Indicates that the uploaded file size exceeds the value specified by the MAX_FILE_SIZE option in the HTML form. 3: Indicates that the file is only partially uploaded.                                                                                                                                                                                                                                            ​Make a judgment, but there is no corresponding judgment for

post_max_size. At this time, the page is actually in a crashed state, and the page will not give any prompts.



For this problem, the current method that comes to mind is to obtain the post_max_size configuration value through the ini_get() function, and then send it to the front desk for verification. Another method is to directly verify in the background and first use ini_get() to obtain the value of post_max_size, and then compare it with the file to be uploaded. However, this requires first obtaining the size of the file through ajax.

qq:411200871 (AVIA Technology), if you have a good way to communicate with each other.

The above introduces the problem of PHP upload file size limit. The impact of post_max_size on the size and its solution, including the content of uploaded files and size. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn