public ActionResult Imagenew() { var model = new ImageModel() { Images = Directory.EnumerateFiles(Server.MapPath("~/images_upload/")) .Select(fn => "~/images_upload/" + Path.GetFileName(fn)) }; return View(model); }
public ActionResult Imagenew(ImageModel model) { if (ModelState.IsValid) { string fileName = ShortGuid.NewGuid().ToString(); string serverPath = Server.MapPath("~"); string imagesPath = serverPath + "/images_upload"; string thumbPath = imagesPath + "/images_upload"; string fullPath = imagesPath + "/images_upload"; ImageModel.ResizeAndSave(thumbPath, fileName, model.ImageUploaded.InputStream, 80, true); ImageModel.ResizeAndSave(fullPath, fileName, model.ImageUploaded.InputStream, 600, true); } return RedirectToAction("Imagenew"); }