pg_lo_read_all(resource connection) bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think I wrote to the list before but I unfortunately didn't see a
response on this.  The functions in PHP to upload a large object work
fine, and I can take out the object using the psql command line interface,
but downloading a file with the php functions over the web the downloaded
file is somehow changed.  Here is a download function which has the
problem:

function send_object() {
   $db = do_db_connect();
   cdb_query($db, "begin");
   $res = pg_lo_open($db, $_POST['object_id'], 'r');
   header("Content-type: " . $_POST['file_type']);
   header("Content-Disposition: file; filename=" . $_POST['filename']);
   header("Content-Transfer-Encoding: binary");
   pg_lo_read_all($res);
   pg_lo_close($res);
   cdb_query($db, "end");
   exit();
}

cdb_query(db, string) is just a simple sql wrapper function that I wrote.

The cmp command clearly shows that the downloaded file is different:

bash-2.05a$ cmp kat_y_justin.jpg kat_y_justin_dl.jpg
kat_y_justin.jpg kat_y_justin_dl.jpg differ: char 1, line 1

I can send the verbose output from cmp if anyone wants more details.

PHP version information:

PHP 4.3.2 (cli) (built: Jun 27 2003 03:24:40)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

Apache version information:

su-2.05a# httpd -v
Server version: Apache/1.3.27 (Darwin)
Server built:   11/12/02 04:24:22

As you can see above, it's running on Mac OS X:

su-2.05a# uname -a
Darwin roc-24-169-140-246.rochester.rr.com 6.3 Darwin Kernel Version 6.3:
Wed Jan  8 19:14:49 PST 2003; root:xnu/xnu-344.16.8.obj~5/RELEASE_PPC 
Power Macintosh powerpc

Any ideas or should I start digging through the PHP source code?  Thanks!

Justin

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux