Copy Code code as follows:
Using System;
Using System.Data;
Using System.Configuration;
Using System.Collections;
Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Web.UI.HtmlControls;
Using System.IO;
Using System.Collections.Generic;
Using System.Web.Configuration;
public partial class Upload:System.Web.UI.Page
{
protected void Page_Load (object sender, EventArgs e)
{
Try
{
Get the data
Httppostedfile jpeg_image_upload = request.files["Filedata"];
Jpeg_image_upload. SaveAs (System.Web.HttpContext.Current.Server.MapPath ("~/upload/") + jpeg_image_upload. FileName);
Response.statuscode = 200;
Response.Write ("File processing complete!") ");
}
Catch
{
If any kind of the error occurs return a Internal Server error
Response.statuscode = 500;
Response.Write ("Unknown error!") ");
}
Finally
{
Clean up
Response.End ();
}
}
}
Packaging Source Download http://www.jb51.net/codes/6210.html