After ajax uses form data to submit the form, it is found that after exceeding the file value set in php, php cannot obtain the files and other post data submitted by the form.
It can be obtained within any limit, but it seems that uploaded file information can be obtained by ordinary form submission.
After ajax uses form data to submit the form, it is found that after exceeding the file value set in php, php cannot obtain the files and other post data submitted by the form.
It can be obtained within any limit, but it seems that uploaded file information can be obtained by ordinary form submission.
If the problem is that the file is too large, it should be detected on the front end first. If it is simply a matter of getting the uploaded file size on the back end:
<code class="php">if($_FILES['file']['size'] > 10485760) { // 這裡是 bytes 等於 10mb // do something }</code>
If the server is nginx
, and the uploaded file exceeds the value set by the client_max_body_size
parameter, this request will not be forwarded to PHP for processing, and will be intercepted at the server level. Visually, your situation may be related to this. relation!
Post_max_size and upload_max_filesize are set in php.ini. After the set size is exceeded, the request cannot be processed normally by PHP.
ajax cannot upload files.
If you are using jQuery, you can consider the plug-in ajaxFileUpload