Re: OID output problems

From: surfer girl <gidget(at)getitgear(dot)com>
To: "Ross J(dot) Reedstrom" <reedstrm(at)wallace(dot)ece(dot)rice(dot)edu>, surfer girl <gidget(at)getitgear(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: OID output problems
Date: 2000-05-03 19:23:24
Message-ID: 20000503182324.5F4CD60B9@sitemail.everyone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The documentation on this is so scarse it's hard to figure out what the right format is supposed to be for all this. After much searching (websites, various mailing list archives), I found the "note" that PHP has a special variable "userfile" for file uploads. This I have changed, and a straight upload to a file works OK, but the Postgres input does not. "$userfile" actually points to a file such as "/tmp/php12595baa" - now, my question is, how do I get the actual BINARY FILE into the database, and not the NAME of the TEMP FILE. (This, at least, explains the bizarre output).

What I had put for my input was taken out of the Addison Wesley book but the explanation was not enough and frankly it's not working. I have yet to find another example of how to do this, and the function reference is cryptic at best.

Any ideas would be absolutely appreciated. Thanks.

--- "Ross J. Reedstrom" <reedstrm(at)wallace(dot)ece(dot)rice(dot)edu>
> wrote:
>> pg_Exec($conn, "BEGIN");
>> $oid = pg_locreate($conn);
>> $handle = pg_loopen($conn, $oid, "w");
>> pg_lowrite($handle, $file);
>
>Hmm, based on my reading of the php4 docs, this will right the contents of the variable
>'file' to the lo, expecting it to be a null terminated string. I'm not sure how you're
>supposed to get binary data in there. Is 'file' by any chance, the name of your file,
>not the contents?
>
>Ross
>--
>Ross J. Reedstrom, Ph.D., <reedstrm(at)rice(dot)edu>
>NSBRI Research Scientist/Programmer
>Computer and Information Technology Institute
>Rice University, 6100 S. Main St., Houston, TX 77005

_____________________________________________________________
Get It Gear --> http://www.getitgear.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Chmara 2000-05-03 19:50:06 Re: OID output problems
Previous Message Matthew 2000-05-03 16:17:24 Removing NOT NULL Contraint