title: Blueimp File Upload: Remove a file from file list before upload
body: <p>How can I remove a file from the selected files list in Blueimp plugins before submitting the form to upload. I tried <a href="https://stackoverflow.com/questions/18267958/how-to-remove-file-from-the-queue-to-stop-upload-before-upload-starts-in-blueimp"><strong>this SO answer</strong></a> but its just remove file from UI not from queue.</p>
  
  <p>Here is my code</p>
  
  <pre><code>$(function(){
              $("#UploadPhotos").click(function(){
                  $("#ItemPhotos").click();
              });
              $('#ItemPhotos').fileupload({
                      url: "${pageContext.servletContext.contextPath}/XYZ",
                      //dataType: 'json',
                      autoUpload: false,
                      acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
                      maxFileSize: 5000000, // 5 MB
                      // Enable image resizing, except for Android and Opera,
                      // which actually support image resizing, but fail to
                      // send Blob objects via XHR requests:
                      disableImageResize: /Android(?!.*Chrome)|Opera/
                          .test(window.navigator.userAgent),
                      previewMaxWidth: 171,
                      singleFileUploads:false,
                      previewMaxHeight: 180,
                      previewCrop: true
                  }).on('fileuploadadd', function (e, data) {
                      data.context = $('&lt;div/&gt;').appendTo('#FilesListThumb');
                      $.each(data.files, function (index, file) {
                          var node = $('&lt;div&gt;&lt;h6&gt;X&lt;/h6&gt;&lt;/div&gt;').addClass("thumbnail-ib");
                          node.appendTo(data.context);
                          node.find("h6").click(function(){
                              node.remove();
                          });
                      });
                      $("#itemSellForm").submit(function(){
                          data.formData = $("#itemSellForm").serializeArray();
                          data.submit();
                          return false;
                      });                        
                  }).on('fileuploadprocessalways', function (e, data) {
                      var index = data.index,
                          file = data.files[index],
                          node = $(data.context.children()[index]);
                      if (file.preview) {
                          node
                              .addClass("thumbnail")
                              .append(file.preview);
                      }
                      if (file.error) {
                          node
                              .addClass("thumbnail")
                              .append($('&lt;span class="text-danger"/&gt;').text("Upload Failed"));
                      }
                  }).on('fileuploadfail', function (e, data) {
                      $.each(data.files, function (index, file) {
                          var error = $('&lt;span class="text-danger"/&gt;').text('File upload failed.');
                          $(data.context.children()[index])
                              .append('&lt;br&gt;')
                              .append(error);
                      });
                  }).on("fileuploaddone",function(e,data){
                    //  sendData = false;
                   alert("done");
                  });
          });
  </code></pre>
  
  <p>here when I click h6 thumbnail is removed from ui only not from the list of ifles</p>