RE: [PHP-DB] Struggling with PG SQL and Large Objects

2002-07-25 Thread eric . jones

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: [EMAIL PROTECTED]
Office - 520-533-6628
Cell - 520-980-2136
Email Pager - [EMAIL PROTECTED]
Direct Private Fax - 866-721-4102

-Original Message-
From: Cornelia Boenigk [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, July 24, 2002 3:17 PM
To: [EMAIL PROTECTED]
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


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Struggling with PG SQL and Large Objects

2002-07-24 Thread eric . jones

CLASSIFICATION: UNCLASSIFIED

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
for folders etc..

Am I wrong?

Eric Jones (Contractor)
FDIC Web Enabler
E-mail: [EMAIL PROTECTED]
Office - 520-533-6628
Cell - 520-980-2136
Email Pager - [EMAIL PROTECTED]
Direct Private Fax - 866-721-4102

-Original Message-
From: Cornelia Boenigk [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, July 24, 2002 11:55 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Struggling with PG SQL and Large Objects


Hi Eric

> I currently can upload the file using pg_lo_import. I get back my
OID which
> I store in a separate table
I think this is the point. PostgreSQL doesn't store the uploaded file
physically in the table but only the OID which is a reference to the file
which is stored in a system catalogue.

> and I can remove the files using the unlink
> command.
To remove the file you pass the OID and PHP does the rest. It means that you
do not access the uploaded file directyly but only its reference.

> However for the life of me I cannot get the file to be downloaded
from a
> person's browsers. I keep getting an error that the file cannot be
found.
Because you 'see' only the reference to this file and only PostgreSQL knows
the place on the harddisk where it is stored.

So if you want to make the uploaded files dowloadable why don't  you store
them somewhere in your filesystem and put the path into your database-table?

Greetings
Conni



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Struggling with PG SQL and Large Objects

2002-07-24 Thread eric . jones

CLASSIFICATION: UNCLASSIFIED

I'm creating a script to upload documents (word, PDF, text, ppt, etc files)
to a PG 7.2 DB.

I currently can upload the file using pg_lo_import. I get back my OID which
I store in a separate table and I can remove the files using the unlink
command.

However for the life of me I cannot get the file to be downloaded from a
person's browsers. I keep getting an error that the file cannot be found.

Does anyone have an example or working script of how to download a file that
has been pg_lo_imported? I do not want to export the file unless I HAVE to..

Looking forward to your guidance!

Eric Jones (Contractor)
FDIC Web Enabler
E-mail: [EMAIL PROTECTED]
Office - 520-533-6628
Cell - 520-980-2136
Email Pager - [EMAIL PROTECTED]
Direct Private Fax - 866-721-4102

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php