SWFUpload and Post Params doesn't work?
Her开发者_高级运维e'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
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
upload_start_handler
event, and setting the params there with addPostParam()
method.
Try using setPostParams
instead of addPostParam
.
I remember having some problems with addPostParam
as well back in the day and now all my code uses setPostParams
.
精彩评论