I'm using Dropzone.js with jQuery to upload files to the server. Afer file uploaded I'm generating a "server-side" filename with the current url.
$('.dropzone').dropzone({
init: function() {
this.on('success', function(file) {
var newname = generateServersideFilename(file.name); // this is my function
// here I need a help to find the thumbnail <img> to set the 'src' attribute
}
}
});
How can I find the current thumbnail img
to set the src
attribute?
$('span:contains("'+file.name+'")').closest('.dz-preview').find('img').attr('src', newname);
- If you know a better way, please share. – Cabstand