开发者

SWFUpload multiple files server-side handling

开发者 https://www.devze.com 2022-12-24 09:59 出处:网络
I need the user to be able to upload multiple files to my server, thus I am using the SWFUpload utility. SWFUpload sends the files one by one, and I need to store them all in the same temporary direct

I need the user to be able to upload multiple files to my server, thus I am using the SWFUpload utility. SWFUpload sends the files one by one, and I need to store them all in the same temporary directory. My AS开发者_JS百科P.NET handler recieves the files one by one and I can store the file appropriately.

My problem is: How do I know which files belong to the same upload? Rephrased, how do I connect the files in my handler?


I see 2 ways to do this (but they inherit the same idea).

The idea is based on the thing you should have something like sessionId parameter. This value should be unique for each set of files. You could use javascript uuid generators or something like so.

Further, this sessionId variable may be passed through query string(a little bit modified your handler url): ~/UploadHandler.ashx?sessionId={whatever} or as post parameter(guess, the better way). The value may be retrieved on the server side by using: context.Request["SessionId"] for example.

On the client side you should be able to change post parameters or handler url dynamically. It could be done by using:

void addPostParam(name, value)

The addPostParam function adds a name/value pair that will be sent in the POST for all files uploaded.

The name/value pair will also appear in the post_params setting.

or

void setUploadURL(url)

Dynamically modifies the upload_url setting.

client methods. They should be called from the

fileDialogComplete(number of files selected, number of files queued, total number of files in the queued)

The fileDialogComplete event fires after the File Selection Dialog window has been closed and all the selected files have been processed. The 'number of files queued' argument indicates the number of files that were queued from the dialog selection (as opposed to the number of files in the queue).

method.

Hope, this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消