I am using Blueimp fileupload for uploading images in my project. After i load up the images, I want to place a button for the each image which can be pressed to clear it from the upload queue before the upload (like the one from the plugin's demo page@ http://blueimp.github.io/jQuery-File-Upload/). I've looked everywhere I can't seem to find a solution that actually works for me.... Here's the code I've been using...
$('#fileupload').fileupload({
dataType: 'json',
autoUpload: false,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
disableImageResize: /Android(?!.*Chrome)|Opera/
.test(window.navigator.userAgent),
imageMaxWidth: 1000,
imageMaxHeight: 800,
previewMaxWidth: 100,
previewMaxHeight: 100,
previewCrop: false
}).on('fileuploadadd', function (e, data) {
//Add buttons for canceling individual images
$("#uploadBttn").click(function () {
data.submit();
});
}).on('fileuploadprocessalways', function (e, data) {
var index = data.index,
file = data.files[index];
if (file.preview) {
$("#imgPreview").append(file.preview);
}
}).on('fileuploadprogressall', function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progress .bar').css('width',progress + '%');
}).on('fileuploadstart', function (e) {
$("#uploadBttn").unbind().prop('disabled', true).text('Uploading...');
}).on('fileuploadstop', function (e) {
$("#uploadBttn").text('Done!');
});