Re: upload binary using postgres
| From: | Richard Lynch | Date: | Sat, 25 Aug 2001 00:31:19 +0000 |
| Subject: | Re: upload binary using postgres | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-64366@lists.php.net to get a copy of this message | ||
Never used bytea so can't help directly but:
You're way better off to store the file as a file and just put the pathname
into Postgre in the first place...
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Ben-Nes Michael <miki@canaan.co.il>
Newsgroups: php.general
To: <php-general@lists.php.net>
Sent: Thursday, August 23, 2001 9:09 AM
Subject: upload binary using postgres
> Hi
>
> Im using php to upload Binary data into bytea field in postgres DB.
> The problem is that when I query what I uploaded I discover that it hold
> only 13 characters and not the whole binary file
>
> I tried manual insert more then 13 characters successfully.
> I tried to do addslashes($data);
>
> but still :(
> $slashed_data = addslashes($data);
> $sql = "insert into files (image_id, bin_data, filename, filesize,
filetype)
> values ('$image_id', '$slashed_data', '$new_name',
> '$filesize',
> '$filetype');";
>
> I tried strlen($slashed_data); before the insert to be sure that that the
> binary is bigger then 13 characters and yes, its 4KB ( the tested file );
>
> Any ideas ?
>
> --------------------------
> Canaan Surfing Ltd.
> Internet Service Providers
> Ben-Nes Michael - Manager
> Tel: 972-4-6991122
> http://sites.canaan.co.il
> --------------------------
>
>