The documentation on this is so scarse it's hard to figure out what the right format is supposed to be for all this.
Aftermuch 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
BINARYFILE 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'snot 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@wallace.ece.rice.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@rice.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