From: | Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com> |
---|---|
To: | Cima <ruel(dot)cima(at)facinf(dot)uho(dot)edu(dot)cu> |
Subject: | Re: downloading files |
Date: | 2005-05-06 11:26:04 |
Message-ID: | 7104a73705050604261fc88551@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi,
On 5/6/05, Cima <ruel(dot)cima(at)facinf(dot)uho(dot)edu(dot)cu> wrote:
> i've uploaded some files into my postgresql db, via a php script,
Are files stored as large objects or simple bytea fields?
> and now
> id like to give a user the posibility to download these files via a php
> script. what would be the best way to do this bearing in mind that the files
> are 'integrated' into the db and are referenced by an oid. the table that
> contains the files has the original filename in one column and the oid of
> the file in another column besides other info on the table.
> any sugestion would be highly apreciated!
I don't advice relying on OIDs. (For further information, you can take
a look at "Object Identifiers" section in PostgreSQL documentation.)
Anyway, you can just output the data from the related table row field.
But before this, you should pass some extra headers to remote client:
<?php
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/octet-stream");
header("Content-Length: " . $theFileSize);
header("Content-Disposition: attachment; filename=$theFileName");
// outputFileFromDatabase();
?>
Regards.
From | Date | Subject | |
---|---|---|---|
Next Message | Vidya | 2005-05-06 13:18:12 | cursor problem |
Previous Message | Cima | 2005-05-06 01:20:34 | downloading files |