download binary files to browser - Mailing list pgsql-php

From Louis Bertrand
Subject download binary files to browser
Date
Msg-id Pine.BSO.4.20.0101071151490.29456-100000@grendel.bts
Whole thread Raw
Responses Re: download binary files to browser  (Stephen van Egmond <svanegmond@bang.dhs.org>)
List pgsql-php
Hello,

I'm keeping binary documents in PostgreSQL and serving them out with PHP,
but I can't figure out how to make the download seamless for the
non-technical end users.

Let's say I have a table documents (docid integer, docoid oid, name
varchar(256)) with a row (123, 123456, 'blah.xyz') that refers to some
some sort of binary file. docid is the primary key.

What should happen:
 user hits URL http://my.site.com/download.php3?docid=123
 user sees the download window in his browser and the download window
already has the file name as "blah.xyz".

What happens:
 I retrieve the LO and send it out with the MIME type
application/octet-stream and the download window comes up with the file
name "download.php3" regardless of the file name.

What headers can I send to fill in that file name?

Thanks
 --Louis  <louis@bertrandtech.on.ca>

Louis Bertrand       http://www.bertrandtech.on.ca/
Bertrand Technical Services, Bowmanville, ON, Canada
Tel: +1.905.623.1500  Fax: +1.905.623.3852

OpenBSD: Secure by default.  http://www.openbsd.org/


pgsql-php by date:

Previous
From: Partyka Robert
Date:
Subject: Re: Autologin problem
Next
From: Stephen van Egmond
Date:
Subject: Re: download binary files to browser