hunostor

Image upload to server directory with post method

Nov 23rd, 2018
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. // very good sample https://github.com/jitendraselvam/ImageUpload/tree/master/ImageUploader
  2. // put in the controller
  3.         [HttpPost]
  4.         public ActionResult Index(HttpPostedFileBase kep)
  5.         {
  6.             if(kep != null)
  7.             {
  8.                 string content = Server.MapPath("/Content");
  9.                 kep.SaveAs(System.IO.Path.Combine(content, "kep.jpg"));
  10.             }        
  11.  
  12.             return RedirectToAction("Index");
  13.         }
Advertisement
Add Comment
Please, Sign In to add comment