My website have a part for image upload from client side.I have problem in showing of images.Because size of pictures are bollix.How can i resize the images when they are uploading?
This my code:
[HttpPost]
public ActionResult Create(int id,HttpPostedFileBase photoFile)
{
if (photoFile != null )
{
Photo photo = new Photo();
photo.Part = db.Parts.Find(id);
photo.PhotoContent = photoFile.ContentType;
photo.PhotoByte = new byte[photoFile.ContentLength];
photoFile.InputStream.Read(photo.PhotoByte, 0, photoFile.ContentLength);
db.Photos.Add(photo);
db.SaveChanges();
return RedirectToAction("Index", new { id = photo.Part.Id });
}
return View();
}