$uploaddir = $_SERVER['DOCUMENT_ROOT'].'/bla/bla/uploads/'; 
$file = $uploaddir . basename($_FILES['uploadfile']['name']);

$data = file_get_contents($uploaddir . $_FILES["uploadfile"]["name"]);



$info["cn"] = $data[$c];
			echo "|onoma-->";
			echo $info["cn"] ;
			$info["sn"] = $data[$c];
			echo "|epwnimo-->";
			echo $info["sn"] ;
			$info["objectclass"][0] = "top";
  		    $info["objectclass"][1] = "organizationalPerson";

$r = ldap_add($ldapconn, "cn=".$info['cn'].",cn=............,ou=.......,ou=......,ou=.....,dc=...,dc=gr", $info);

so i get the attributes i want from the file correctly (i have also counted them and tried anything that proves i get the string from the attribute)...
but i get the warning below

Warning: ldap_add() [function.ldap-add]: Add: Invalid DN syntax

when i insert the attributes like:

$info["cn"] = "�����";
    		$info["sn"] = "��������";

they are inserted fine in the ldap server...

the thing i just tried is with

// Open a memory "file" for read/write...
$fp = fopen('php://temp', 'r+');
// ... write the $input array to the "file" using fputcsv()...
fputcsv($fp, $input, $delimiter, $enclosure);
// ... rewind the "file" so we can read what we just wrote...
// ... read the entire line into a variable...
$data = fread($fp, 1048576); // [changed]
// ... close the "file"...
// ... and return the $data to the caller, with the trailing newline from fgets() removed.

and it comes back to me that is not an array
does anyone think that this may cause the problem on the problem i face?

solved as simple as i couldn't imagine...
for a reason was not accepting
the iconv anywhere else but...

$info["cn"] =iconv("Windows-1253","UTF-8",$data[$c]);
			//echo "|onoma-->";
			//echo $info["cn"] ;
			$info["sn"] = iconv("Windows-1253","UTF-8",$data[$c]);

so for all the greeks out there this is the way is being done....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.