Required parameters are missing upload file using Php curl
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2017 03:39 AM
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;
Labels:
- Labels:
-
Alfresco Content Services
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2017 10:36 AM
Also previously posted here: https://community.alfresco.com/thread/214270-upload-a-file-in-alfresco-repository-using-php-and-curl...
