Rich controls mainly include:
(1) FileUpload control
(2) Calender control
(3) AdRotator control
(4) MultiView control
(5) Wizard control
This note focuses on the simple use of the FileUpload control.
1. The FileUpload control is used for users to upload files to the Web application.
(1) Save the file to the file system
After FileUpload control browsing Select the local file to upload, click the OK button to upload, the code looks like this:
protected void Button1_Click (object sender, EventArgs e)
{
if (fileupload1.hasfile)
{
if (Checkfiletype (fileupload1.filename))
{
string dpath = MapPath ("~/uploa Dfile ");
DirectoryInfo dr = new DirectoryInfo (dpath);
if (!DR. Exists)
Dr. Create ();//If the specified picture storage directory does not exist, the directory
string filePath = "~/uploadfile/" + fileupload1.filename;
Fileupload1.saveas (MapPath (FilePath));//save uploaded file
datalist1_databind ();
}
}