Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  6] [ 1]  / answers: 1 / hits: 18675  / 10 Years ago, fri, may 23, 2014, 12:00:00

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?


More From » jquery

 Answers
4

This worked for me:



$('.dropzone').dropzone({
init: function() {
this.on('success', function(file) {
var newname = generateServersideFilename(file.name); // this is my function
// changing src of preview element
file.previewElement.querySelector(img).src = newname;
}
}
});


dropzonejs have few examples of using file.previewElement


[#70870] Thursday, May 22, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
corie

Total Points: 371
Total Questions: 110
Total Answers: 113

Location: Cambodia
Member since Thu, Oct 7, 2021
3 Years ago
;