PHP: how to limit the size of uploaded files _ PHP Tutorial

Source: Internet
Author: User
PHP limits the size of uploaded files. In practice, we will find that setting the file upload size in php. ini is very troublesome and error-prone. So, today we will teach you several specific solutions. In practice, we will find it very troublesome to set the file upload size in php. ini, and it is easy to make mistakes. So, today we will teach you some specific Solution:

PHP limits the size of the uploaded file to the first:

Check the following lines in php. ini:

Upload_max_filesize = 8 M

Post_max_size = 10 M

Memory_limit = 20 M

Change these values to what I said to see if there are any problems. Also, confirm the uploaded

There is no line similar to the following

This also limits the upload size.

PHP restricts the second size of the uploaded file:

If apache 2 needs to be modified

/Etc/httpd/conf. d/php. conf

In, change LimitRequestBody 524288 to 524288 (= 512 × 1024), for example, 5 M (= 5 × 1024 × 1024)

After PHP restricts the size of the uploaded file, the file upload will not encounter the above problem. The Upload will not respond, and the upload will be solved if the page cannot be uploaded!


Bytes. So, today we will teach you some specific solutions...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.