Ejemplo n.º 1
0
        public virtual ActionResult ImageUpload(HttpPostedFileBase file)
        {
            file.IsImageFile();
            var fileName = Guid.NewGuid() + Path.GetExtension(file.FileName);
            var filePath = Server.MapPath("~/App_Data/tmp/" + fileName);

            file.SaveAs(filePath);
            return Json(new
            {
                url = Url.Action("Index", "Home", new { area = "File", name = fileName }),
                name = fileName
            });
        }
Ejemplo n.º 2
0
        // GET: File/SlideShow
        public ActionResult Upload(HttpPostedFileBase file)
        {

            file.IsImageFile();

            var fileName = Guid.NewGuid() + Path.GetExtension(file.FileName);

            var filePath = Server.MapPath("~/Content/SlideShowImages/" + fileName);


            file.SaveAs(filePath);

            return Json(fileName);
        }