0
我在github插件上打開了一個問題,但它似乎並不是非常活躍,所以我也在這裏問過。使用kartik-v bootstrap文件輸入插件無法顯示驗證錯誤
我通過ajax發送我的文件,但是當上傳失敗(因爲高度太小)我沒有得到真正的錯誤消息,但我從我的ajax網址得到一個錯誤,但這個沒有任何意義因爲沒有發送。 我認爲ajax路線不應該被調用,但無論如何,我試圖玩'fileuploaderror',我得到了想要的錯誤,但我不知道如何顯示它們。在fileuploaderror事件中必須有一個簡單的方法,但我不知道它。 任何人都可以幫助我這個嗎?
感謝
$("#id").fileinput({
uploadUrl: "/ajax/snippet/image/send/78", // server upload action
deleteUrl: "/ajax/snippet/image/remove/",
uploadAsync: false,
showUpload: false, // hide upload button
showRemove: false, // hide remove button
maxFileCount: maxFile,
browseOnZoneClick: true,
language: "fr",
minImageWidth: 150,
minImageHeight: 150,
allowedFileExtensions: ["jpg", "jpeg", "gif", "bmp", "png"],
multiple: true,
maxFileSize: 5000,
uploadExtraData: function (previewId, index) {
return {key: index};
},
initialPreviewAsData: true,
overwriteInitial: false,
}).on("filebatchselected", function (event, files) {
// trigger upload method immediately after files are selected
$(this).fileinput("upload");
}).on('fileuploaderror', function (event, data, msg) {
var form = data.form, files = data.files, extra = data.extra,
response = data.response, reader = data.reader;
// get message
alert(msg);
});
}