Created
February 8, 2013 23:52
-
-
Save adatta02/4742959 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var progressElements = { }; | |
$(document).ready( function(){ | |
$("#fileUploads").fileupload({ | |
dataType: 'json', | |
done: function(e, data){ | |
var fileName = data.files[0].name; | |
var el = progressElements[ data.files[0].name ]; | |
el.find("img:first").attr("src", data.result.thumbnail); | |
el.find(".progressbar").hide(); | |
}, | |
progress: function(e, data){ | |
var el = progressElements[ data.files[0].name ]; | |
var progress = parseInt(data.loaded / data.total * 100, 10); | |
el.find(".bar").css('width',progress+"%" ); | |
}, | |
add: function(e, data){ | |
var template = $("#reviewTemplate").html(); | |
$("#newImages").before(template); | |
progressElements[ data.files[0].name ] = $("#uploadContainer .uploadedImage:last"); | |
$("#fileUploads").fileupload("send", {files: data.files}); | |
}, | |
autoUpload: true, | |
url: 'myUploadUrl', | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment