HtmlFileInput control

  • Thread starter Thread starter Shimon Sim
  • Start date Start date
S

Shimon Sim

I need to examine posted file before saving to the server. HtmlPostedFile
doesn't seem to give any information about the file except for full path on
user machine.
I'd like to check extension, date created and some other information that is
exposed as properties for FileInfo. Is there a way to convert HtmlPostedFile
to FileInfo?
Thanks,
Shimon.
 
PostedFile has a Filename, ContentType and ContentLength attribute. From
the filename you can get the extension. And you can use
System.IO.Path.GetExtension() to quickly extract the extension. There's
nothing else you can get (like date created)...that information isn't part
of the file, it's part of the OS, and it isn't uploaded along with the file.

Karl
 
Back
Top