I need resize this image proportionally heigth 411px.
how do this?
[HttpPost]
public WrappedJsonResult UploadImage(HttpPostedFileWrapper imageFile, int id)
{
if (imageFile == null || imageFile.ContentLength == 0)
{
return new WrappedJsonResult
{
Data = new
{
IsValid = false,
Message = "No file was uploaded.",
ImagePath = string.Empty
}
};
}
var fileName = String.Format("{0}_{1}.jpg", id, Guid.NewGuid().ToString());
var imagePath = Path.Combine(Server.MapPath(Url.Content("~/Content/UploadPhoto")), fileName);
imageFile.SaveAs(imagePath);
}
By the way you will notice that I have replaced
HttpPostedFileWrapperwithHttpPostedFileBasein the action signature as this is the correct type to use.