I want to upload image file into alfresco using cmis api using PHP.. I can create simple text document in alfresco using following code
$obs = $client->createDocument($myfolder->id, $repo_new_file,$prop, "testssss", "text/plain");
I tried following code to upload image
$obs = $client->createDocument($myfolder->id, $repo_new_file,$prop, null, "image/jpeg");
But can't create image file into alfresco
Can anyone help me to solve this issue ??
I got the solution of this problem
Just store base64 content into image.. Use below code
$filename="A.jpg";
$handle = fopen($filename, "r");
if(!$handle)return FALSE;
$contents = fread($handle, filesize($filename));
if(!$mimetype)$type=mime_content_type($filename);
else $type=$mimetype;
fclose($handle);
$base64_content=base64_encode($contents);
$obs = $client->createDocument($myfolder->id, $repo_new_file,$prop, base64_decode($base64_content), "image/jpg");