SWFUpload and asp.net

Hello,
I just discovered this site and it seems to be just what I have been looking for. However, when I tried to add it to my asp.net application I ran into a problem. I added a "select files" button which allows the user to add files to the queue. Then I have a separate button "upload" which commences the upload.

What I would like to do when the user clicks "upload" is to upload all files and then run an asp.net server-side function. I tried to use the asp:button control, but since the upload executes separately, the control does not wait for the files to finish uploading before sending the postback.

Is this possible to accomplish?

I tried to create two buttons: one which starts the upload and one which does postback, and then somehow call the .click() event for the second button in the uploadComplete handler but I cannot seem to get this method to work. Any ideas? I am rather new to javascript, mainly I have just used simple confirm dialogs and mouseover effects until now.

Thanks,
Owen

gyphie's picture

What I do...

What I do is create a regular HTML button and then use:

Page.GetPostBackEventReference(myControl, "arg"); [depricated]
or
Page.ClientScript.GetPostBackEventReference(myControl, "arg");

To give JavaScript the function it needs to trigger a postback.

-----------------
Example:

<button type="button" onclick="swfu.startUpload()">Upload</button>

function uploadComplete(file) {
if (this.getStats.files_queued === 0) {
<%=Page.ClientScript.GetPostBackEventReference(null, "");
}
}

-----
Note: I didn't test this so you might have to fiddle and research a bit before it works.