[英]Returning correct error message in Kendo Upload if file too big
Kendo Upload遇到一些问题。 当文件小于最大大小(15MB)时,就可以了。 但是,如果它大于最大大小,则不会进入“上传”操作,但仍会返回消息“完成”。
@(Html.Kendo().Upload()
.Name("files")
.ShowFileList(false)
.Async(a => a.Save("Upload", "Document", new {@id = Model.ChangeRequestId})
.AutoUpload(true))
.Events(e => e
.Complete("refreshFileList"))
)
如果执行该操作,那么我将能够检查文件大小并返回适当的消息。 如果文件太大,是否有人能够成功处理Kendo Upload的问题?
谢谢
为什么不在客户端进行文件大小验证呢?
如果需要,使用上upload
事件检查大小并显示消息/中止下载。
.Events(e => e.Upload("onUpload"))
function onUpload(e) {
var files = e.files;
$.each(files, function () {
if (this.size > 15*1024*1024) {
alert(this.name + " is too big!");
e.preventDefault(); // This cancels the upload for the file
}
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.