1
0
Fork 0

My version: issue accessing img in the previewHtml.

This commit is contained in:
Andrew Tomaka 2011-11-02 12:45:37 -04:00
parent 096bcb6284
commit 965d5e809c

View file

@ -1,14 +1,38 @@
var previewHtml =
'<div class="preview">' +
'<span class="imagePreview">' +
'<img /><span class="imageSuccess"></span>' +
'</span>' +
'<div class="imageProgress"><div class="progressBar"></div></div>' +
'</div>';
$('#drop').filedrop({ $('#drop').filedrop({
url: 'upload.php', url: 'upload.php',
paramname: 'file', paramname: 'file',
maxfiles: 4, maxfiles: 4,
maxfilesize: 1, maxfilesize: 1,
uploadFinished: function(i, file, response, time) { beforeEach: function(file) {
// alert('temp attempting upload') ;
}, },
beforeEach: function(file) { uploadStarted: function(i, file, len) {
alert('temp attempting upload') ; var reader = new FileReader();
reader.onload = function(e) {
alert(e.target.result);
$('img',$(previewHtml)).attr('src', e.target.result);
}
reader.readAsDataURL(file);
$(previewHtml).appendTo($('#drop'));
$.data(file, $(previewHtml));l
},
progressUpdated: function(i, file, progress) {
$.data(file).find('.progressBar').width(progress);
},
uploadFinished: function(i, file, response, time) {
$.data(file).addClass('complete');
}, },
error: function(type, file) { error: function(type, file) {