Demo:
Example:
public void DownloadPicture(object sender, EventArgs e) { ImageButton button = sender as ImageButton; if (button != null) { string fileName = button.CommandArgument; this.Response.AddHeader( "content-disposition", string.Format( "attachment;filename={0}", Path.GetFileName(fileName))); this.Response.ContentType = "image/jpg"; this.Response.WriteFile(this.Server.MapPath(fileName)); } }
No comments:
Post a Comment