download binary files to browser

From: Louis Bertrand <louis(at)bertrandtech(dot)on(dot)ca>
To: pgsql-php(at)postgresql(dot)org
Subject: download binary files to browser
Date: 2001-01-07 17:36:31
Message-ID: Pine.BSO.4.20.0101071151490.29456-100000@grendel.bts
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)bertrandtech(dot)on(dot)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/

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Stephen van Egmond 2001-01-07 17:41:37 Re: download binary files to browser
Previous Message GH 2001-01-06 17:52:51 Re: PHP and PostgreSQL