note 43537 added to function.pg-escape-bytea

From: Date: Thu, 24 Jun 2004 18:44:06 +0000
Subject: note 43537 added to function.pg-escape-bytea
Groups: php.notes 
Request: Send a blank email to php-notes+get-71613@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/function.pg-escape-bytea.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43537 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43537&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43537&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71613) next »