0

I have a project in mvc where in I upload the pdf file and save the data to the database, how can I display that link to the page and when user click the link he can download that file?

Ramppy Dumppy
  • 2,667
  • 7
  • 27
  • 37
  • It's not so much a question of how to display the link. Downloads are usually triggered by headers set by the server. The [Content-Disposition](http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html) header should be what you're looking for... – War10ck Mar 17 '14 at 00:51
  • Hi @War10ck.. Thanks for your answer I just want to ask if I can do it using a javascript alone..? Do you have sample? Thanks.. – Ramppy Dumppy Mar 17 '14 at 02:30
  • This is probably a duplicate of [this SO](http://stackoverflow.com/questions/1510451/how-to-return-pdf-to-browser-in-mvc). You don't need to use javascript, just create an anchor that points to the appropriate controller/action/id. – rfernandes Mar 17 '14 at 03:30
  • You can use this link [Download File Using Javascript/jQuery][1] [1]: http://stackoverflow.com/questions/3749231/download-file-using-javascript-jquery – iamsuman Mar 17 '14 at 05:39

1 Answers1

0
<a href="pdf/xyz.pdf.htm">click to download</a>

I don't know how to save file in database but I am sure that it will let user download that file.

Hope this will help.

krupal
  • 854
  • 2
  • 11
  • 17