Re: How to force download?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Steve C. Orr [MVP, MCSD] (Steve_at_Orr.net)
Date: 04/19/04


Date: Mon, 19 Apr 2004 13:31:10 -0700

Use Response.Writefile to output the PDF file.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttpresponseclasswritefiletopic.asp

Then add a line of code like this:
Response.AddHeader("Content-Disposition","attachment;filename=myfile.pdf");
The "attachment" specification requests the browser to download the file
instead of opening it. But ultimately it is up to the browser and the user
to decide what they want to do with the file; you don't have 100% control of
this from the server.

-- 
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Miguel Dias Moura" <internetNoSpam@27lamps.com> wrote in message
news:ue9X3skJEHA.2380@TK2MSFTNGP09.phx.gbl...
> Hello,
>
> in my web site i display some links to PDF files. This links are loaded
from
> a database.
> Anyway, when i click these links the PDF files are open in the visitors
> browser and in Acrobat.
>
> How can i force the files to be downloaded when the person clicks the
link?
> I don't want to use zip files.
>
> Thank You,
> Miguel
>
>
>


Relevant Pages

  • Re: Corrupt pdf files with zero KB
    ... I seem to be getting corrupt pdf files. ... The most common would be that your web browser requests the ... terminating the download before the remote server responds. ...
    (comp.sys.mac.apps)
  • Re: On-line Godel book updated
    ... Where's a readable LaTex version? ... Paste that into "Address" window at the top of your browser. ... and right-click with the mouse on the download link. ... either postscript or or .pdf files. ...
    (sci.logic)
  • Re: Quicktime and Real Player alternatives
    ... >> I download the Orkney Today newspaper in .pdf format. ... What Web Browser are you using to do the Downloading of these ... Box (for .PDF Files) ... which loads of people often have probs with & the way to make ...
    (uk.people.silversurfers)
  • Re: Corrupt pdf files with zero KB
    ... I seem to be getting corrupt pdf files. ... The most common would be that your web browser requests the ... terminating the download before the remote server responds. ...
    (comp.sys.mac.apps)
  • Re: Trouble with uploading links to host
    ... Go back to the site and download from the first page ... files are pretty big pdf files, but at least it is recognizing the command ... your pdf files to your website, and write the link to where you upload ... Most of us find that having a separate folder for downloads on our ...
    (microsoft.public.publisher.webdesign)