I have an element file chooser that allows a user to select a file for upload. As soon as the file is selected, it is uploaded to the windows server 2008 and written to disk in a Windows temporary folder. The serverside code is written in C#.
My question: As the file is transfered to the server, is there a way to access attributes of the file being uploaded such as the file size or file type from within C# server code? Would I be able to grab it from an HttpWebRequest or an HttpMultiPartWebRequest or something?
I would appreciate all / any suggestions from the asp.net community.
Here's a tutorial on uploading a file in C# using a Web Form:
Obtaining information about the file itself:
Here are some relevant parts from that second linked article:
"You can use the
ContentLengthproperty to get the length of the file. You can use the
ContentTypeproperty to get the MIME content type of the file. In addition, you can use the
PostedFileproperty to access the
InputStreamproperty, and the
SaveAsmethod. However, the same functionality is provided by the
FileContentproperty, and the