How can I prompt if the size of the file uploaded by php exceeds the limit of post_max_size?

Source: Internet
Author: User
Tags upload php
When php processes file uploads that exceed the post_max_size limit, how does one prompt a problem found during the test of a recent project? when my uploaded file exceeds the post_max_size limit, the page does not respond, only the post_max_size value can be passively Retrieved. after the value of post_max_size is modified, it is found that the uploaded file is larger than the size limit of the post_max_size file uploaded by upload php. how can I prompt
A problem found during the test of the latest project is that when the size of the uploaded file exceeds the limit of post_max_size, the page does not respond and can only passively modify the value of post_max_size, after modifying the value of post_max_size, we found that the size of the uploaded file is greater than the size set by upload_max_filesize. The size of the file obtained is 0.

What I want now is to give the user a prompt in advance that the file to be uploaded is too large to be uploaded ????


------ Solution --------------------
Ini_get () can obtain some parameters in php. ini. Compare $ _ FILES ["file"] ["size"] with upload_max_filesize.

Alternatively, you can use the error code $ _ FILES ["file"] ["error. If the value is greater than 0, the upload is incorrect. If the value is 1, it indicates that the size of upload_max_filesize is exceeded.
------ Solution --------------------
Yes! It's no longer a php task to use js.
------ Solution --------------------
Customer segment control.
------ Solution --------------------
Discussion

Reference:

Customer segment control.

I don't understand how the client controls it? The fileSize method I found online using js is not easy to use. can you elaborate!

------ Solution --------------------
PHP can also be controlled, but requires a verification page and then uses the second floor method.

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.