qq.FileUploader: 取消提交
我正在使用插件 qq.FileUploader。
在提交文件之前,我想知道是否已经上传了同名文件。
我正在使用这段代码:
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader-requestDocuments'),
action: '<%: Url.Action("Create", "RequestDocument") %>',
params: { id: $('#RequestTempUploadFolderID').val() },
sizeLimit: 10520000,
onSubmit: function (id, fileName)
$('#file-uploader-requestDocuments').find('.qq-upload-file').each(function () {
if ($(this).text() == fileName) {
return false;
return true;
});
}
});
return false 是正确的,但它不会停止提交!
如何停止文件上传,以及有更好的方法来获取已经上传的文件吗?
I'm using the plugin qq.FileUploader.
Before submitting file, I want to know if a file with the same name has already been upload.
I'm using this code:
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader-requestDocuments'),
action: '<%: Url.Action("Create", "RequestDocument") %>',
params: { id: $('#RequestTempUploadFolderID').val() },
sizeLimit: 10520000,
onSubmit: function (id, fileName)
$('#file-uploader-requestDocuments').find('.qq-upload-file').each(function () {
if ($(this).text() == fileName) {
return false;
return true;
});
}
});
The return false is correct, but it does not stop the submit!
How stop the file upload, and there is a better way to get the file already uploaded?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的服务器端进行检查怎么样?!并在 AJAX 中返回响应,以获取重复的文件名?!
编辑
如果你的服务器响应如下:
你可以拥有该 JS 代码:
how about doing that checking in your server side?! and returning a response in AJAX, for duplicate file names?!
EDIT
if your server response this:
you can have that JS code: