1
我正在使用Dropzone允許用戶上傳文件,以允許用戶將圖像與頁面上幾個標題之一相關聯。我以編程方式生成Dropzones,每個標題一個,並且當文件上傳時,我保存在一個數據庫中,該標題與哪個上傳文件相關聯。如何以編程方式將縮略圖添加到Dropzone?
我非常喜歡上傳文件時生成的Dropzone縮略圖。在頁面加載中,我想查詢服務器上的現有圖像,並將這些圖像放在正確的dropzone的縮略圖中。
如何以編程方式將URL中的縮略圖關聯到特定的Dropzone?
我dropzones的代碼是:
$(function() {
$('.newdrop').each(function (index) {
var id = parseInt($(this).closest("a").attr("id"));
var dropzoneID = "#drop" + id;
var newDropzone = new Dropzone(dropzoneID, {
url: "/VoltLink/SaveUploadedFiles/" + id,
clickable: false,
maxFiles: 1,
init : function() {
this.on("addedfile", function() {
if (this.files[1]!=null){
this.removeFile(this.files[0]);
}
});
}
}
);
});
});
我有一個服務器端功能的查詢,發現標題與圖片,這就要求通過SignalR的方法
lnk.client.updateImage = function(image) {
var headingID = image.ID;
$('#' + headingID + ' .existingImage').html(image.imageURL);
}
如何使用'image.imageURL'來激活dropzone縮略圖?