I am working on Angular js MVC application. I need a local file path which user selects from his/her local file system. I know I can't get full file path in Javascript so I tried to get this using c#. So I added 1 chtml page with input box & controller to get the file Here is chtml code
<div class="col-md-9">
@using (Html.BeginForm("GetFile", "File", FormMethod.Post, new { enctype = "multipart/form-data" })) {
<input type="file" name="file" />
<input type="submit" name="Submit" id="Submit" value="Upload" />
}
</div>
In controller I wrote
[HttpPost]
public ActionResult GetFile(HttpPostedFileBase file) {
if (file != null) {
string justFileName = Path.GetFullPath(file.FileName);
}
return justFileName;
}
}
Also I have added the route in routeprovider
.when('/File', {
templateUrl: 'File/Index'
})
I can easily access this page via URL. But now I need to call this page in an AngularJS modal popup or to show in a page itself on button click. I'm a bit newer to AngularJS. I tried with ng-view but it won't work. Please let me know If I am in a wrong direction? Is there any way to call chtml inside HTML? The question may be misleading but It is my final moto.