[thelist] Initiating a Download

evolt at david.us-lot.org evolt at david.us-lot.org
Mon Aug 19 19:27:01 CDT 2002


On Mon, Aug 19, 2002 at 04:35:40PM -0700, Jake Aust wrote:
> Hi...
>
> I would like to create a link on my site to a .gif or .jpeg file that
> doesn't open the file in a browser window. I would like it instead to
> initiate a download that will present the user with a "save as" dialog and
> save the .gif or .jpeg to their local machine.
>
> Is there a way to do this with PHP? JavaScript? I know I've seen it done,
> but I don't know how to do it.

The usual hack is to tell the server to (using the Content-type http
header [header() function in PHP]) claim that the image is not an
image. User education about the save function of their browser is more
reliable.

--
David Dorward                                   http://david.us-lot.org/
HTML email is a bit like using coloured paper and glitter ink on a CV.



More information about the thelist mailing list