RE: [PHP-DB] Struggling with PG SQL and Large Objects
| From: | eric dot jones at hua dot army dot mil | Date: | Thu, 25 Jul 2002 20:13:36 +0000 |
| Subject: | RE: [PHP-DB] Struggling with PG SQL and Large Objects | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-20797@lists.php.net to get a copy of this message | ||
CLASSIFICATION: UNCLASSIFIED
Do you have any examples of uploading via post and downloading via visiting
a download page for this?
Eric Jones (Contractor)
FDIC Web Enabler
E-mail: jonese@hua.army.mil
Office - 520-533-6628
Cell - 520-980-2136
Email Pager - 5209802136@messaging.nextel.com
Direct Private Fax - 866-721-4102
-----Original Message-----
From: Cornelia Boenigk [mailto:c@cornelia-boenigk.de]
Sent: Wednesday, July 24, 2002 3:17 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Struggling with PG SQL and Large Objects
Hi Eric
> It was my understanding (from a friend) that I could actually store
the
> files in the database and thereby eliminate me having to setup
permissions
If you use the large-objects-interface then the files go somewhere else and
the references (OIDs) are stored in the tables.
Another way is to store large objects by using the PostgreSQL-datatype BYTEA
which is a octet-stream of your data. If you use this datatype the objects
will be stored in the tables directly. But you have to escape the stream
before storing and to unescape when you retrieve it. Since PHP 4.2 you can
use the function pg_escape_bytea() before inserting. To unescape the
selected data use stripcslashes(). I think this schould work.
Another way is to use base64_encode() to encode the data and then insert and
base64_decode() after you retrieved it. This way the data is also stored in
the table directly.
Greetings
Conni
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php