Hi dharmendr,
I need two upload controls and buttons on single view.
If i place two upload controls and one button is working fine but i need separate.
For One Upload control one button and another one upload control another button.
I tried to give separate names but no luck for me.
@Html.TextBoxFor(m => m.ROIfile, new { type = "file",name="ROI", @class = "form-control" })
<button id="btnROIUpload" class="btn btn-primary" type="button" onclick="location.href='@Url.Action("ROIUpload", "ProjectUpload")'">ROIUpload</button>
@Html.TextBoxFor(m => m.file, new { type = "file"",name="DOC",, @class = "form-control" })
<button id="btnDocUpload" class="btn btn-primary" type="button">DOCUpload</button>
public ActionResult ROIUpload(ProjectUpload importExcel)
{
string fileExtension = System.IO.Path.GetExtension(importExcel.file.FileName);
string name = importExcel.ProjectCode + "-" + DateTime.Now.ToString("yyyyMMdd");
string path = Server.MapPath("~/Content/Upload/" + "Project_Upload_" + "ROIDocuments-" + name + fileExtension);
importExcel.file.SaveAs(path);
}
public ActionResult DOCUpload(ProjectUpload importExcel)
{
string fileExtension = System.IO.Path.GetExtension(importExcel.file.FileName);
string name = importExcel.ProjectCode + "-" + DateTime.Now.ToString("yyyyMMdd");
string path = Server.MapPath("~/Content/Upload/" + "Project_Upload_" + "DOCDocuments-" + name + fileExtension);
importExcel.file.SaveAs(path);
}
Kindly let me know where i missed.
Thanks in advance.