After javascript-ajax uses formdata to submit a form, php checks the file size.

Source: Internet
Author: User
After ajax uses formdata to submit a form and finds that the file value in php is exceeded, php cannot obtain the files submitted by the form and other postdata data. It can be obtained without exceeding the limit, but normal form submission seems to be able to obtain the information of the uploaded file. After ajax uses form data to submit a form and finds that the file value in php is exceeded, php cannot obtain files submitted by the form and other post data.

It can be obtained without exceeding the limit, but normal form submission seems to be able to obtain the information of the uploaded file.

Reply content:

After ajax uses form data to submit a form and finds that the file value in php is exceeded, php cannot obtain files submitted by the form and other post data.

It can be obtained without exceeding the limit, but normal form submission seems to be able to obtain the information of the uploaded file.

If the file is too large, you should first restore the file on the front-end. if it is a simple upload, the backend obtains the size of the uploaded file:

If ($ _ FILES ['file'] ['size']> 10485760) {// bytes equals 10 mb // do something}

If the server isnginxIf the number of uploaded files exceedsclient_max_body_sizeThe value set by the parameter. this request will not be forwarded to PHP for processing. it will be intercepted at the server level. it may be related to your situation!

Post_max_size and upload_max_filesize are set in php. ini. after the configured size is exceeded, the request cannot be processed properly by PHP.

Ajax cannot upload files.

If you are using jQuery, consider the plug-in ajaxFileUpload.

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.