Re: Re: large object problem
| From: | Manuel Lemos | Date: | Mon, 17 Dec 2001 17:38:27 +0000 |
| Subject: | Re: Re: large object problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-77965@lists.php.net to get a copy of this message | ||
Hello,
David H wrote:
>
> Manuel,
>
> Thanks for the comment. I am able to load the output
> correctly, if I do a import directly from the server.
> I am only having trouble with the upload code. Any
> idea from the code below?
Sure, the problem is that you think that $img contains the contents of
the uploaded file but in fact it contains just the name of the temporary
file to which the uploaded file was copied. You need to open that
temporary file and read its contents to store the BLOB.
Regards,
Manuel Lemos
>
> Thanks,
> David
>
> --- Manuel Lemos <mlemos@acm.org> wrote:
> > Hello,
> >
> > David H wrote:
> > >
> > > Hi all,
> > >
> > > I am trying to findout what is wrong with this
> > script
> > > can anyone help?
> > >
> > > $dbconn = pg_connect ("cnnection string")
> > >
> > or die (
> > "Error: ".pg_errormessage
> > > ($dbconn)) ;
> > >
> > > pg_exec ($dbconn, "begin") ;
> > > $oid = pg_locreate ($dbconn) ;
> > > $fd = pg_loopen ($dbconn, $oid, "w") ;
> > > pg_lowrite ( $fd, $img ) ;
> > > pg_loclose ( $fd ) ;
> > > $strqry = "INSERT INTO tblImg ( myname,
> > mytype,
> > > myimg, myfilesize ) VALUES ( '$img_name',
> > '$img_type',
> > > '$oid', $img_size )";
> > > $result = pg_exec ( $dbconn, $strqry ) ;
> > > pg_exec ($dbconn, "commit") ;
> > > pg_exec ($dbconn, "end") ;
> > >
> > > The output that I am getting is this
> > >
> > > /tmp/phpQPUyx2
> > >
> > > by pg_loreadall function.
> >
> > Similarly, you need to do pg_loopen on a OID
> > returned by a select query.
> >
> > Anyway, if you want to try something that works with
> > easier to
> > understand interface, maybe you would like to try
> > Metabase which is a
> > database abstraction PHP package that provides a
> > single and portable
> > interface to BLOBs that supports PostgreSQL among
> > many other databases.
> >
> > Metabase is free and you may download it from here:
> >
> >
> http://phpclasses.UpperDesign.com/browse.html/package/20
> >
> > Regards,
> > Manuel Lemos
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail:
> > php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail:
> > php-general-help@lists.php.net
> > To contact the list administrators, e-mail:
> > php-list-admin@lists.php.net
> >
>
> __________________________________________________
> Do You Yahoo!?
> Check out Yahoo! Shopping and Yahoo! Auctions for all of
> your unique holiday gifts! Buy at http://shopping.yahoo.com
> or bid at http://auctions.yahoo.com