The following code snippet shows how to download folders in asp.net
private void DownloadFile(string fname, bool forceDownload) { string path = MapPath("upload") + "\\" + fname; string name = Path.GetFileName(path);
if (forceDownload) { Response.AppendHeader("content-disposition", "attachment; filename=" + name); } Response.WriteFile(path); Response.End(); } protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if(e.CommandName=="xyz") { string id=e.CommandArgument.ToString(); Response.Redirect("nextpage.aspx?name=" + id); }
if (e.CommandName == "mahua") { string picpath = Convert.ToString(e.CommandArgument); int len = picpath.Length; picname = picpath.Substring(9, len - 9); DownloadFile(picname, true); }
//name of the folder/is upload////////////
|
No responses found. Be the first to respond and make money from revenue sharing program.
|