November 2008
Beginner
320 pages
7h 6m
English
Stop running the personal portal. Return to the Design view of the Default.aspx page. Double-click Upload. Visual Web Developer opens the corresponding Microsoft Visual C# code-behind file called Default.aspx.cs. A new method has been created called BtnUpload_Click automatically for you. (See Figure 12-7.)

Figure 12-7. New BtnUpload_Click method.
Type the code in Example 12-3 into the BtnUpload_Click method.
Example 12-3. BtnUpload_Click Code
if (this.FileUpload1.HasFile)
{
string filename = Server.MapPath("~/Mydocuments") + "\\" + this.FileUpload1.FileName;
this.FileUpload1.SaveAs(filename);
}The code first tests ...
Read now
Unlock full access