SWF上传 + jQuery.SWFUpload - 从队列中删除文件
我面临着一个大问题。
首先,这是我的代码:
.bind('uploadSuccess', function(event, file, serverData){
if(serverData === 'nofile') {
var swfu = $.swfupload.getInstance('#form');
swfu.cancelUpload(file.id); // This part is not working :(
} else {
alert('File uploaded');
}
})
在这部分中,我正在检查服务器响应(我有严格的验证限制)。现在我的问题。是否可以从队列中删除上传的文件?基本上,如果服务器返回错误,我会显示错误消息,但是...该文件仍然存在于队列中(我已经实现了检查文件名和文件大小以避免重复上传)并且用户无法替换该文件(由于上传和队列限制)。
我试图寻找解决方案,但没有成功。有什么想法吗?
问候,
汤姆
I'm facing a big issue IMO.
First, here's my code:
.bind('uploadSuccess', function(event, file, serverData){
if(serverData === 'nofile') {
var swfu = $.swfupload.getInstance('#form');
swfu.cancelUpload(file.id); // This part is not working :(
} else {
alert('File uploaded');
}
})
In this part I'm checking server response (I'm have strict validation restrictions). Now my question. Is it possible to remove uploaded file from queue? Basically, if server returns error I display error message, but... this file still exsit in the queue (I've implemented checking filename and filesize to avoid duplicated uploads) and user is not possible to replace this file (due to upload and queue limit).
I was trying to search for a solution, but without success. Any ideas?
Regards,
Tom
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自链接
http://swfupload.org/forum/generaldiscussion/881
可能你必须在向服务器发送任何内容之前保留文件ID
From the link
http://swfupload.org/forum/generaldiscussion/881
Probably you have to keep the file ID before sending anything to the server