I need to upload some xml files .For this I need to open from my MVC application a popup to load a file .I wrote the code below.In the controller I see the loaded file .
Upload.cshtml:
@using (@Html.BeginForm("UploadFile", "UploadFileController", FormMethod.Post, new { @id = "uploadForm", @enctype = "multipart/form-data" }))
{
<div>
@Html.TextBoxFor(m => m.FileName, new { type = "file" })
<button type="submit" class="btn">Upload</button>
</div>
}
Controller :
[HttpPost]
public ActionResult UploadFile(UploadFileModel uploadFileModel)
{
....
}
Model:
public class UploadFileModel
{
public int Id { set; get; }
public HttpPostedFileBase FileName { get; set; }
}
Now ,the "Upload.cshtml" is a part and appear in the home page . 1.How can I transform it in a separate form ?This part appear when I press a button. 2.How can I show in the search dialog just xml files ?
Thanks .