forcing a file to download
<blockquote>
  <p><strong>Duplicate:</strong> <a href="http://stackoverflow.com/questions/531292/any-way-to-force-download-a-remote-file">http://stackoverflow.com/questions/531292/any-way-to-force-download-a-remote-file</a></p>
</blockquote>

<p>I have a php page with information, and links to files, such as pdf files. The file types can be anything, as they can be uploaded by a user.</p>

<p>I would like to know how to force a download for any type of file, without forcing a download of links to other pages linked from the site. I know it's possible to do this with headers, but I don't want to break the rest of my site.</p>

<p>All the links to other pages are done via Javascript, and the actual link is to #, so maybe this would be OK?</p>

<p>Should I just set </p>

<pre><code>header('Content-Disposition: attachment;)
</code></pre>

<p>for the entire page?</p>
