I'm planning to add file upload using ajax and form submission in same view
@model project_name.Models.ProductFinanceFeatures
@{
}
<h2>--------File_Upload-------------</h2>
@using (Ajax.BeginForm("Financing_Product_Feature_Upload", "FileUpload", new { enctype = "multipart/form-data" }, new AjaxOptions() { HttpMethod = "POST" }))
{
@Html.AntiForgeryToken()
<input type="file" name="files">
<input type="submit" value="Upload File to Server">
}
<h2>-------Form_Submission-----</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
......
</div>
}
this is my controller class method for ajax
[HttpPost]
public ActionResult Financing_Product_Feature_Upload(HttpPostedFileBase files)
{
...
}
once I select a file and click "upload" button ,then I debug this I can see files
value become null