net*_*djw 4 javascript jquery dropzone.js
我正在使用带有jQuery的Dropzone.js将文件上传到服务器.上传文件我正在使用当前网址生成"服务器端"文件名.
$('.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
}
}
});
Run Code Online (Sandbox Code Playgroud)
如何找到当前缩略图img来设置src属性?
Yak*_*rNa 11
这对我有用:
$('.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;
}
}
});
Run Code Online (Sandbox Code Playgroud)
dropzonejs几乎没有使用file.previewElement的例子
| 归档时间: |
|
| 查看次数: |
14030 次 |
| 最近记录: |