Guest User

Untitled

a guest
Jan 23rd, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. /// <param name="fullFilePath">Path to file on disc</param>
  2. /// <param name="fileName">Name of file. This will be displayed in browser's save dialog</param>
  3. public FilePathResult DownloadFile(string fullFilePath)
  4. {
  5. var fileName = new FileInfo(fullFilePath).Name;
  6. var contentType = System.Web.MimeMapping.GetMimeMapping(fullFilePath);
  7. return new FilePathResult(fullFilePath, contentType)
  8. {
  9. FileDownloadName = fileName
  10. };
  11. }
Add Comment
Please, Sign In to add comment