Jude
1/26/2014 9:04:13 PM
In MVC, you don't use Server controller.
Try this code to upload a file in MVC
1.
public
ActionResult Index(HttpPostedFileBase file)
2.
{
3.
4.
var fileName = Path.GetFileName(file.FileName);
5.
6.
var uploadpath = Path.Combine(Server.MapPath(
"Path where you want to store the file"
), fileName);
7.
file.SaveAs(uploadpath);
8.
}
This content has not been rated yet.
106
Reputation
16
Total posts