niks
niks

Reputation: 554

FileUpload control event

I want to know how to raise an event for fileupload control.... In my project, as soon as I select a file(Image) it should show FILENAME,EXTENSION & SIZE in the labels given below.

Pls reply me....

Thanks in advance.

Upvotes: 0

Views: 1103

Answers (3)

Kimny
Kimny

Reputation: 1

You can use this code to get file information as soon as you select the file.

int filesize = FileUpload1.PostedFile.ContentLength;
string fileextension = FileUpload1.PostedFile.ContentType
string filename = Path.GetFileName(FileUpload1.FileName);

Upvotes: 0

Kronass
Kronass

Reputation: 5406

Unfortunately this is not possible you need first to upload the file and then get it's information and add them to labels, otherwise you need to use third party plug-in to able you to do that such as flash or java applets.

Upvotes: 0

SLaks
SLaks

Reputation: 887245

Until HTML5 becomes mainstream, it is completely impossible to do this without uploading the entire file to the server. (Except maybe with Flash)

Upvotes: 1

Related Questions