Search code examples
javascriptswfupload

SWFUpload and Post Params doesn't work?


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:

enter image description here

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

Solution

  • 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.