Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderators: ArturoRobles, ArturoRobles

I am unable to upload a single file or multiple files in processmaker .
I referred the documentations listed below: ... t-document ... _uidupload
But when I call the api to upload file the request returns with error code 0.
Also the $oResponse returns null.
Here is my code:
Code: Select all
$inputDocId = '2699784865e2155c3e04a43081494049';
$taskId     = '6255531755e0dff921e5466035447157';
$caseId     = '2992109955e26871503f671072958707';
$url        = "$caseId/input-document";
$nFiles = count($_FILES['file']['name']);
$access_token = '3a21f7a2e052d1ad31a91fb24deb50da8a5d9196';

for ($i = 0; $i < $nFiles; $i++) {
   $path = $_FILES['file']['tmp_name'][$i];
   $type = $_FILES['file']['type'][$i];
   $filename = $_FILES['file']['name'][$i];
   //rename file from temp name to real name:
   rename($path, sys_get_temp_dir() .'/'. $filename); //reverse \ for windows systems

   $aVars = array(
      'inp_doc_uid'     => $inputDocId,
      'tas_uid'         => $taskId,
      'app_doc_comment' => '',
      'form'            => (phpversion() >= "5.5") ? new CurlFile($path, $type) : '@'.$path

   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $access_token));
   curl_setopt($ch, CURLOPT_POSTFIELDS, $aVars);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   $oResponse = json_decode(curl_exec($ch));  // returns null in my case.
   $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
//    unlink(sys_get_temp_dir() .'/'. $filename); //delete file

    if ($httpStatus == 200) {
        print "File ". $oResponse->app_doc_uid ." uploaded.\n";
    elseif (is_object($oResponse) and isset($oResponse->error)) {
        print "Error code: {$oResponse->error->code}\n" .
            "Message: {$oResponse->error->message}\n";
    else {
        print "Error code: $httpStatus";

I have also tried uploading file using the endpoint mentioned in the link below. ... _uidupload
Still it returns with same errors as mentioned in the above method.

Also I am using the extraRest plugin version 1.13
please help me out asap.
disable value in dropdown

Check box is more helpful rather than drop down op[…]

Timeout Not Sending Email

I would like to thank you for the efforts you have[…]

use 'insert into' in a trigger

Is your syntax correct? Shouldn't you be using s[…]

issue with processmaker 3.2

You mean the code in the trigger below? That is t[…]