Home >Backend Development >PHP Tutorial >Specific solutions to limit upload file size in PHP_PHP Tutorial

Specific solutions to limit upload file size in PHP_PHP Tutorial

WBOY
WBOYOriginal
2016-07-15 13:29:14835browse

In specific practice, we will find that setting the file upload size in php.ini is very troublesome and error-prone. Well, today we will teach you several specific solutions:

PHP limits the size of uploaded files No. 1:

In php.ini Check the following lines:

upload_max_filesize = 8M

post_max_size = 10M

memory_limit = 20M

Change these values ​​to what I said and see if there is any problem. Also confirm the upload< ;form> There is no line similar to the following

This is also used to limit the upload size.

PHP limits the size of uploaded files second:

If it is apache 2, it needs to be modified

/etc/httpd/conf.d/php.conf

Change LimitRequestBody 524288 in 524288 (=512×1024) to a larger size, such as 5M (=5×1024×1024)

After PHP limits the upload file size, the above problems will not occur when uploading files. In response, the page cannot be uploaded and will be resolved!


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446395.htmlTechArticleIn specific practice, we will find that it is very troublesome to set the file upload size in php.ini, and It’s also easy to make mistakes. So, today we will teach you some specific solutions...
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