How to let users download files?

Discussion in 'Web Design and Development' started by londonweb, Jul 10, 2006.

  1. londonweb macrumors 6502

    londonweb

    Joined:
    Sep 14, 2005
    Location:
    london
    #1
    Does anyone know how to offer files as downloadable from a web site?

    For example, I want to offer a pdf file for download, instead of a simple link to open it in a new page. Is it possible to instigate the user's download manager and have it download to the desktop, for instance?
     
  2. angelneo macrumors 68000

    Joined:
    Jun 13, 2004
    Location:
    afk
    #2
    I'm not sure if you know php but you can do it via the header (something like this, you may have to tweak a little):

    Code:
       header("HTTP/1.1 200 OK");
       header("Content-Length: $filesize");
       header("Content-Type: application/force-download");
       header("Content-Disposition: attachment; filename=$filename");
       header("Content-Transfer-Encoding: binary");
    
     
  3. londonweb thread starter macrumors 6502

    londonweb

    Joined:
    Sep 14, 2005
    Location:
    london

Share This Page