Re: PHP 4.0 Bug #5702: Inserting an uploaded JPEG file into Openldap
| From: | Stig Venaas | Date: | Thu, 20 Jul 2000 15:48:49 +0000 |
| Subject: | Re: PHP 4.0 Bug #5702: Inserting an uploaded JPEG file into Openldap | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-25233@lists.php.net to get a copy of this message | ||
On Thu, Jul 20, 2000 at 02:48:53PM -0000, john.hallam@compaq.com wrote:
> From: john.hallam@compaq.com
> Operating system: SuSE Linux 6.3
> PHP version: 4.0.1pl2
> PHP Bug Type: LDAP related
> Bug description: Inserting an uploaded JPEG file into Openldap
>
> I'm having trouble inserting a JPEG file into the jpegphoto attribute (Openldap 1.2.11).
>
> >From the documentation I have read I should be storing a base64 value in the jpegphoto
> >attribute. I have managed to insert the photo with an ldap client and then made an LDIF extract to
> >look at the base64 encoding. When I try to insert the jpegphoto with PHP, the base64 encoding is
> >identical (I did an "echo" to print things on the screen) as to what I see with the LDIF
> >extract. When I look at the openldap database I see totally different values than what I expect.
>
> When I insert the jpegphoto with an LDAP client (LDAP Browser/Editor by Jarek Gawor - freeware)
> I can display the photo with the Netscape browser and I can see the base64 encoding correctly on the
> slapd server.
What I think happens is this:
When you store binary data you are _not_ supposed to base64 code it first
(in LDIF file yes, but not else), so I think that the LDAP server accepts
your base64 data, base64 encodes it again(!) and stores it in the data-
base. When you look at it with some client including PHP I think you will
be able to get the base64 data you stored back, decode it and display it,
but clients will expect binary data from the LDAP server not base64 data.
Hope this makes at least some sense. At present I think you can only read
binary data with PHP using ldap_get_value_len, and that there is no way to
store binary data.
Unless someone can fix this soon, it should be added to the TODO list.
I want to fix it, but I don't have time now and need a reminder.
Stig