我是Jquery文件上传的新手,它工作得很好。但是我想知道是否有人知道一个好方法来阻止发送上传,直到可以发送GET请求来 * 验证文件是否已经存在 *?
我正在使用backbone.js,并且已经尝试将拦截附加到提交表单事件和文件输入更改事件。两者都被绕过。
目前的外观如下所示:
events: {
'change form.upload-file input': 'checkExist'
},
checkExist: function (e) {
return false;
},
initialize: function () {
_.bindAll(this);
this.$('.upload-file').fileupload({
dataType: 'json',
method: 'PUT',
add: this.add,
progress: this.progress,
done: this.done,
fail: this.fail,
always: this.always
});
return __super__.initialize.apply(this, arguments);
},
1条答案
按热度按时间bxjv4tth1#
我只是通过手头有一个文件列表并停止xhr(如果包括的话)来解决这个问题
如果能知道一种异步的方法,那就太好了。