Plupload 和错误生成
我正在开发一个使用 plupload 库进行文件上传的应用程序。我似乎无法让文件上传工作,因为存在某种错误,但我无法让此错误发出警报或记录。
有人能够做到这一点吗?
这是我当前的代码:
uploader.bind('Error', function(error){
console.log(error);
});
提前感谢您的帮助!
I am working on an application that uses the plupload library for file uploading. I can't seem to get the file uploading working because there is some kind of error but I can't get this error to alert or log.
Has anyone been able to do this?
Here is my current code:
uploader.bind('Error', function(error){
console.log(error);
});
Thanks in advance for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
所以我知道这可能太晚了,但我刚刚开始使用 plupload 并且心情很好......
控制台从不记录任何内容的原因是因为您所做的绑定仅在所有上传完成后才会发生。
您需要将此代码放在
$('form').submit()
行之前:So I know this is probably way too late, but I just started with plupload and was in a helpful mood...
The reason the console never logs anything is because the binding that you are doing only occurs when all uploads have been completed.
You need to put this code before the
$('form').submit()
line:绑定到错误事件需要两个参数:
Binding to the error event requires two params:
另一个迟到的答案。如果我是你,我会从将以下内容开始:
更改为:
以及类似的内容:
更改为:
另外,我会将所有这些绑定移出 $(form).submit。
只是为了简单性和可调试性。
不幸的是仍然不知道你的脚本出了什么问题。也许你错过了:
也许:
没有触发。
不过,每行后面的一些 console.log 应该会有所帮助。 :)
Another late answer. If I were you i would start with changins stuff like:
into something like:
and stuff like that:
into:
Also I would move all these binds out of $(form).submit.
Just for sake of simiplicity and debugability.
Unfortunately still have no idea what's wrong with your script. Maybe you are missing:
Maybe:
is not triggering.
Nevertheless some console.log after each line should help. :)
这是我尝试让它工作的整个代码库
Here is my entire code base for trying to get this to work
我还在寻找 Plupload 小部件提供的错误处理机制,但没有一个答案有效。所以这是有效的(每个版本 2.1.2):
“init”对象有更多支持的事件,请参阅 http://www.plupload.com/examples/events
I was also searching for error handling mechanism provided by Plupload widget, none of the answers were working. So here is the working one (per version 2.1.2):
The "init" object has more supported events, refer to http://www.plupload.com/examples/events