Hello
I have created web from in asp.net on which user can upload kml file (Google earth file).
I have saved uploaded file in folder and file path in database.
Now on download button click I have to give same file for download
I got file path from database but I am unable to write code for download functionality
Please suggest code thanks
con.Close();
SqlCommand cmdkml = new SqlCommand("select * from FileMaster where ClientId='" + ddlclient.SelectedValue.ToString() + "' and FileType='KML' order by Srno DESC", con);
con.Open();
SqlDataReader sdrkml = cmdkml.ExecuteReader();
if (sdrkml.HasRows)
{
sdrkml.Read();
Response.ContentType = "application/vnd.google-earth.kml+xml";
string s1 = sdrkml.GetValue(3).ToString();
string s2 = sdrkml.GetValue(4).ToString();
Response.AppendHeader("Content-Disposition", "attachment; filename=" + s2);
Response.TransmitFile(Server.MapPath(s2));
Response.End();
}
s1 and s2 are filename and file path respectively retrieved from database table