Required parameters are missing upload file using Php curl

cancel
Showing results for 
Search instead for 
Did you mean: 
farqalit_nasir
Member II

Required parameters are missing upload file using Php curl

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;
1 Reply
janv
Alfresco Employee

Re: Required parameters are missing upload file using Php curl