Upload pictures upload pictures and modify their size
Thefile is a file Field HTML control
Thefile. Postedfile.saveas (System.Web.HttpContext.Current.Server.MapPath ("temp.png"));
MemoryStream memstream=new MemoryStream ();
System.Drawing.Image imgoutput =system.drawing.bitmap.fromfile (System.Web.HttpContext.Current.Server.MapPath (" Temp.png "));
Modified to 80x80 size
System.Drawing.Image imgoutput2=imgoutput.getthumbnailimage (80,80,null,intptr.zero);
Imgoutput2.save (System.Web.HttpContext.Current.Server.MapPath ("Image.png"), imageformat.png);
Response.Write (Thefile. Postedfile.filename);
Response.Write ("Len:" +memstream.length.tostring ());
Imgoutput.dispose ();
Imgoutput2.dispose ();
Response.Write ("Upload success!");
Response.Write (System.Web.HttpContext.Current.Server.MapPath ("image.png"));
-----------------------------------------
What is it like to float? Heaven and earth a gull.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.