This blog is moved to

Tuesday, May 27, 2008

FileUpload Control

The FileUpload control in .Net 2.0 is rendered in browser as
html input="file"

One drawback of this control is that, if we look into the OpenFileDialog and OpenSaveDialog there will be filter. Filters allows us to display particular
file type. But in FileUpload control we don't have this filter option.

One way to get rid of this is using Regular Expression Validator.

We can use the following regular expression.


Now in server side we can upload the file using

FileUpload.SaveAs() method.

We can get the current path using the Server.MapPath method

string filepath = Server.MapPath("tempcsv");


No comments: