Wesly
Wesly

Reputation: 679

FileUpload .net control

I want to make various actions on the uploaded file once it is on the server, question is how do I catch the event the upload is done? Currently when I try to access the file I get an error that it does not exists, I assume because the upload has not finished. (I tested the upload seperately and it worked)

Thanks!

Wes

Upvotes: 0

Views: 94

Answers (1)

CodingGorilla
CodingGorilla

Reputation: 19872

A file upload, in a web page (whether asp.net or otherwise) is not an asynchronous upload operation. The file is encoded and then included in the GET or POST request when it is transmitted to the server. So if you're operating from the code-behind of an ASP.NET web page, and IsPostBack is true, then the file has been uploaded.

Probably what you are missing is that the file is not automatically saved to the file system. You need to call the SaveAs method on the asp.net file upload control to take the file out of the request stream and save it to the file system.

Upvotes: 3

Related Questions