Link to home
Start Free TrialLog in
Avatar of QuiAO
QuiAOFlag for Norway

asked on

How can I add jpegphoto mages to LDAP with PHP?

Hi,
I have created a script for adding information about a user to LDAP.
I have a folder with jpg-images, and I want to upload them to the LDAP-server.

I have written a base64_encode function, like this:


<?php

function encodeImage($imgfile) {
      $imgbinary = fread(fopen($imgfile, "r"), filesize($imgfile));
      return (base64_encode($imgbinary));
}



But it does not work, beacuse LDAP does not like the output of this function...?

I hav to implement this to an existing system, so it have to be written in PHP.


Does anybody have some tricks for me?

btw, if I write some other info, for instance "TEST" to the field, it works... So LDAP connection with php working fine.
Avatar of tonyszko
tonyszko
Flag of United States of America image

What LDAP server?  This what attribute you are trying to write this information? What error is being returned when you are trying to upload this value?
ASKER CERTIFIED SOLUTION
Avatar of perezjos
perezjos
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
good to close for me thanks
Jose