Project Description
Download Source code
Click Register to see File upload demo
in Account Controlller,
I have done following changes
AcceptVerbs(HttpVerbs.Post)
public ActionResult Register(RegisterModel model, IEnumerable< HttpPostedFileBase > file)
string physicalPath = HttpContext.Server.MapPath("../")
"UploadImages" "\\";
for (int i = 0; i < Request.Files.Count; i++)
{
Request.Files[0].SaveAs(physicalPath + System.IO.Path.GetFileName(Request.Files[i].FileName));
}
Iin view -> RegisterPartial.ascx
using (Html.BeginForm((string)ViewBag.FormAction, "Account", FormMethod.Post, new { enctype = "multipart/form-data" }))
< li > < b > Please select File : < / b > < input type="file" id="FileUpload1" name="FileUpload1" / >< br / >