have an upload Excel functionality which will upload the data from excel to a Asp.net Text Box control. Currently my asp.net application is hosted on SharePoint 2010 environment. When the excel is uploaded it will be saved on the server machine location(Example : C:\Test) and it will be called again from the server location to process the data by the access database engine and uploaded to text box control on sever as comma separated values.
The challenge is we cannot save the file on the server location due to security concerns from our admins. Is there a way to save the file in my local machine when i browse and click upload and then pass the same local machine path to server to process my request(Basically we want to save the file on the user local machine instead of server physical path). Can anyone please throw some light on this issue. Below is the code i am using currently to store in the server location(which i want to change it to user local machine).
strTarget =Server.MapPath(fileUpload.FileName);string[] arrCheckExtension = strTarget.Split('.');if(arrCheckExtension.Length>=2){if(arrCheckExtension[1].ToString().Equals("xls")|| arrCheckExtension[1].ToString().Equals("xlsx")){
fileUpload.SaveAs(strTarget);
strConnForExcel =String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;""", strTarget);
strQueryForExcel =String.Format("select id from [{0}$]","Test");OleDbDataAdapter adap =newOleDbDataAdapter(strQueryForExcel, strConnForExcel);
ds =newDataSet();
adap.Fill(ds);if(ds.Tables[0].Rows.Count>0){for(int i =0; i < ds.Tables[0].Rows.Count; i++){if(strids ==""){
strids += ds.Tables[0].Rows[i]["id"].ToString();}else{
strids +=","+ ds.Tables[0].Rows[i]["id"].ToString();}}
txtUpload.Text= strids;}}else{Response.Write("<script language='javascript'>alert('Please Select File with .xls or xlsx Extension');</script>");}}