Created
December 14, 2013 15:54
-
-
Save KresimirKoncicNeuralab/7960893 to your computer and use it in GitHub Desktop.
File force download [c#]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// full path to your file | |
string yourFilePath = HttpContext.Current.Request.PhysicalApplicationPath + "imageFolder\\yourFile.jpg"; | |
// save downloaded file as (name) | |
string saveFileAs = "yourFile.jpg"; | |
Response.Clear(); | |
Response.AddHeader("content-disposition", "attachment; filename=" + saveFileAs); | |
Response.WriteFile(yourFilePath); | |
Response.ContentType = ""; | |
Response.End(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment