How to abort an in-progress upload?

Follow

Comments

2 comments

  • Avatar
    Lucas Nelson

    The link to the github issue (https://github.com/blueimp/jQuery-File-Upload/issues/290) is returning a 404.

    0
    Comment actions Permalink
  • Avatar
    Lucas Nelson

    I struggled to get this to work when there are fileupload validations in the mix (eg. maxFileSize). The selection of an invalid file was triggering an upload. This does no happen when using the default 'add' handler.

    I suggest two improvements:

    1. Disable the default autoUpload behaviour:
      $('.cloudinary-fileupload').cloudinary_fileupload({
      autoUpload: false
      // plus any other options, eg. maxFileSize
      });

    2. Use the 'fileuploadprocessalways' event to do the submit:
      $(".cloudinary-fileupload").bind('fileuploadadd', function(e, data) {
      if (data.files.error && data.files[data.index].error) {
      // do something to show the user the validation error
      } else {
      jqXHR = data.submit(); // Catching the upload process of every file

      // and change the UI to let the user know an upload is in progress
      }
      });

    0
    Comment actions Permalink

Please sign in to leave a comment.