简体   繁体   中英

jquery-file-upload Uploaded bytes exceed file size

I'm using jquery-file-upload plugin to upload some files. I have a bind to the add callback where I collect the files to upload and on form submit i'm issuing the 'send' command to begin the upload.

The problem i'm facing is that the fail callback is called upon successful upload with the following error message: "Uploaded bytes exceed file size"

can anyone explain me what does this error mean? and why I keep getting it?

I appreciate the help.

10x

I was getting this error as well but I was setting the dataType value to be JSON. I remove the dataType open and stopped getting this error.

This only worked for me as I was not getting Json back

I was also getting this kind of error. And it took me a whole day to find the cause of the problem. So, I changed a lot of things and among them:

  • I explicitly set "upload_tmp_dir" directive in php.ini - it was irrelevant;
  • Checked and increased values for both "upload_max_filesize" and "post_max_size" directives in php.ini - it was also not the cause.
  • Created all the folders in my document root directory: "images/" and "images/temp/" - didn't help though is necessary.

The problem was that there was a separate root for AJAX post request for image preliminary upload (Silex/Symfony library), and in the example I copied, the author (deliberately) left out the "url" option from the request, as in:

$('#fileupload').fileupload({
    dataType: 'json',
    url: '/post/upload', // this was missing
    replaceFileInput: false,
    fileInput: $('input:file'), ...  

At the same time, the form, where this element belonged to, had its own route set to "/post/" and, with "url" option missing, the plug-in, obviously took it from the parent form.

As such, no controller was called, the uploaded file was unprocessed, and the text of the error was misleading.

PS. This "auto substitution" by the plug-in might also affect the methods used for request (PUT or POST), as I used both in controllers - "PUT" for the form and "POST" for the fileupload management, but I didn't check.

I tried reviewing all available messages in console and I found this

always: function(e, data) {
    console.log(data.jqXHR.responseJSON.files[0].error);

In my part, I got the error due to the file I'm uploading exceeds the upload_max_filesize directive in php.ini

The won't give the you the exact error.

console.log(data.messages);

Make sure your form only has inputs that are what AWS expects. Do not add extra form fields of your own. Or if you do, remove them with JS before the AWS upload begins.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM