SWFUpload 和 Post 参数不起作用?
这就是我正在做的事情:
swfu = new SWFUpload(...);
swfu.addPostParam('id', 1);
当调用 swfu.startUpload(); 时,我设置了一个断点。查看 swfu 对象,我可以看到参数设置正确:
当然而,检查 fiddler 中的结果帖子,我看不到这个参数。我发布到的服务器(.net mvc 3)也没有拾取它。
我尝试过 SWFUpload 的 2.2 和 2.5 版,但都没有效果。我缺少什么?
编辑:
启用调试模式,我可以看到引发此错误:
Exception calling flash function 'SetPostParams': __flash__argumentsToXML is not defined
Here's what I'm doing:
swfu = new SWFUpload(...);
swfu.addPostParam('id', 1);
When swfu.startUpload();
is called, I've set a breakpoint. Looking into the swfu
object I can see the params are set appropriately:
When checking the resulting post in fiddler however, I can't see this parameter. It also isn't being picked up by the server I'm posting to (.net mvc 3).
I've tried version 2.2 and 2.5 of SWFUpload, no dice with either. What am I missing?
Edit:
Enabling debug mode, I can see this error is raised:
Exception calling flash function 'SetPostParams': __flash__argumentsToXML is not defined
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根本问题基本上归结为当我尝试设置参数时 SWFU 没有完全初始化。这必须在上传开始之前触发的事件之一中完成。我正在使用该
事件,并使用
addPostParam()
方法设置参数。The root problem basically came down to SWFU not being fully initialised when I tried to set the params. This has to be done in one of the events that fire before an upload commences. I'm using the
event, and setting the params there with
addPostParam()
method.尝试使用
setPostParams
而不是addPostParam
。我记得当时在
addPostParam
方面也遇到了一些问题,现在我的所有代码都使用setPostParams
。Try using
setPostParams
instead ofaddPostParam
.I remember having some problems with
addPostParam
as well back in the day and now all my code usessetPostParams
.