2015-10-16 55 views
4

我想用PHP .. 使用CMIS API圖像文件上傳到戶外上傳在露天的圖像文件,我可以利用創建露天簡單的文本文件下面的代碼如何使用PHP

$obs = $client->createDocument($myfolder->id, $repo_new_file,$prop, "testssss", "text/plain"); 

我嘗試下面的代碼上傳圖片

$obs = $client->createDocument($myfolder->id, $repo_new_file,$prop, null, "image/jpeg"); 

但不能創建鏡像文件到露天

誰能幫我解決這個問題?

回答

1

我得到了這個問題

只是存儲的base64內容爲圖像的解決方案..使用下面的代碼

$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");