Hi,
I tried all available solutions but failed to upload file because of this error
stdClass Object ( [status] => stdClass Object ( [code] => 400 [name] => Bad Request [description] => Request sent by the client was syntactically incorrect. ) [message] => Required parameters are missing [exception] => [callstack] => Array ( ) [server] => Community v5.2.0 (re21f2be5-b22) schema 10,057 [time] => Nov 2, 2017 12:28:05 PM )
My Code is
$urlws = 'http://' . $user . ':' . $pw . '@' . $server . ':' . $port . '/alfresco/service/api/upload?alf_ticket=' . $ticket;
$postvars = array(
'filename' => $fileName,
'filedata' => '@'.realpath($fileName),
'destination' => $createFolderResponse,
'uploaddirectory' => '/Fari1',
'description' => 'File example',
'contenttype' => 'cm:content',
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_PORT, $port);
curl_setopt($ch, CURLOPT_URL, $urlws);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);
$uploadFileResponse = json_decode(curl_exec($ch));
echo("<pre>");
print_r($uploadFileResponse);exit;
Also previously posted here: https://community.alfresco.com/thread/214270-upload-a-file-in-alfresco-repository-using-php-and-curl...
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.