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