note 43537 deleted from function.pg-escape-bytea by vincent
| From: | vincent@php.net | Date: | Thu, 24 Jun 2004 18:50:52 +0000 |
| Subject: | note 43537 deleted from function.pg-escape-bytea by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71614@lists.php.net to get a copy of this message | ||
Note Submitter: user@NOSPAM.example.com
----
I can't for the life of me, save an image to a bytea field in a postgresql database, pull it
back out and use it. I've tried all the examples I've seen with no luck.
In fact, I can't even pass a string through pg_escape_byte() and pg_unescape_bytea() (see
below) and get the same results! What's going on?!!!
$fp = fopen($upload_file, "r");
$contents = fread($fp, filesize($upload_file));
fclose($fp);
print "filesize: " . filesize($upload_file) . "<br>";
print "length of string before escape: " . strlen($contents) . "<br>";
$contents = pg_escape_bytea($contents);
print "length of string after escape: " . strlen($contents) . "<br>";
$contents = pg_unescape_bytea($contents);
print "length of string after unescape: " . strlen($contents) . "<br>";
filesize: 8192
length of string before escape: 8192
length of string after escape: 24998
length of string after strip: 20719