Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- namespace UploadFiles.Controllers
- {
- public class UploadController : Controller
- {
- // GET: Upload
- public ActionResult Index()
- {
- return View();
- }
- [HttpPost]
- public ActionResult Upload(HttpPostedFileBase file)
- {
- if (file != null && file.ContentLength > 0)
- {
- var fileName = Path.GetFileName(file.FileName);
- var path = Path.Combine(Server.MapPath("~/Images/"), fileName);
- file.SaveAs(path);
- }
- return RedirectToAction("UploadDocument");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement