I am trying to store file to uploads folder under App_Data folder
HttpPostedFileBase file = files[i];
string extension = Path.GetExtension(file.FileName);
if (Path.GetExtension(file.FileName) == ".csv")
{
if ((file != null) && (file.ContentLength > 0) && !string.IsNullOrEmpty(file.FileName))
{
string fileName = file.FileName;
string fileContentType = file.ContentType;
byte[] fileBytes = new byte[file.ContentLength];
NameValueCollection nvc = new NameValueCollection();
nvc.Add("test", "teststr");
nvc.Add("sample", "samplestr");
// store the file inside ~/App_Data/uploads folder
var path = Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data/uploads"), fileName);
file.SaveAs(path);
}
}
When I run the application in Chrome and Firefox it works fine and var path returns me "D:\Sampleapp\webportal\SampleWeb\App_Data\uploads\ShoesImportExample.csv" which is correct.
But when I run the application in IE11 var path returns "C:\Users\sagar.j\Desktop\ShoesImportExample.csv" this is the path from where i selected the file.
So how can i get the path "D:\Sampleapp\webportal\SampleWeb\App_Data\uploads\ShoesImportExample.csv" in IE11.. Thanks in Advance..