Goal:
Make a evaluation of the picture’s format, width and height and then saving it in my program.
problem:
Don’t know how to use the HttpPostedFileBase file and then sending it to Image newImage = Image.FromFile(xxxx); without saving the picture in my program.
- Validation
- save picture in my “App_Data”
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Add(HttpPostedFileBase file)
{
if (file.ContentLength > 0)
{
Image newImage = Image.FromFile(xxxx);
}
return Index();
}
You could do this somehow like the following snippet. Notice the
System.Drawingnamespace reference, you will need for theImage.FromStream()method.