Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
public string Addgrievance(Dictionary<string, string> attributes, Dictionary<string, byte[]> files)
{
string returnresult = "Fail";
try
{
con.Open();
SqlCommand comm = new SqlCommand();
comm.Connection = con;
comm.CommandType = CommandType.StoredProcedure;
comm.CommandText = "MBL_MOB_APP_CMS";
comm.Parameters.AddWithValue("@Qtype", 19);
comm.Parameters.AddWithValue("@Description", attributes["Description"].ToString());
comm.Parameters.AddWithValue("@Username",attributes["UserName"].ToString());
comm.Parameters.AddWithValue("@Status", 1);
string filePath="";
foreach (KeyValuePair<string, byte[]> pair in files)
{

filePath = HttpContext.Current.Server.MapPath(string.Format("~/AssistanceSchemeFile/{0}", pair.Key ));

File.SaveAs(pair.Key);

}

int result = comm.ExecuteNonQuery();

if (result > 0)
{
returnresult = "Success";
}

// obj.returnresult = returnresult;
return returnresult;
}
catch (Exception)
{
throw;
}
}

What I have tried:

i am Using File Upload in WEB API and i Get File in Dictionary<string, byte[]> files
and when i try to save in apllication then i get Exeption in Line-

File.SaveAs(pair.Key);
'System.IO.File' does not contain a definition for 'SaveAs'
so please help me
How to Fix this Issues
Posted
Updated 7-Mar-18 3:20am

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900