Http请求发送空文件

时间:2015-05-26 14:08:27

标签: php rest bonita

我在php中创建了这个http请求,将上传的文件发送到bonitasoft,我从http请求中得到没有错误,我将文件成功上传到我的计算机,但不知何故,bonitasoft通过此请求获取了一个空文件。我不能使用CURL。

$data1 = array(
"caseId"=> $case_id[1],
"file"=> basename($_FILES['file_attach']['name']),
"name"=>"doc_Invoice",
"fileName"=>"document_1.png",
"description"=> "draft" );
    //Structure of process data to start case with document
        $options1 = array(
        'http' => array(
        'method'  => 'POST',
        'header'=>  "POST /bonita/API/bpm/caseDocument  HTTP/1.1\r\n".
                    "Host: localhost\r\n".
                    "Cookie: ". $display[1]."\r\n".
                    "Content-Type: application/json\r\n" .
                    "Accept: application/json\r\n".
                    "Cache-Control: no-cache\r\n".
                    "Pragma: no-cache\r\n".
                    "Connection: close\r\n\r\n",
         'content' => json_encode($data1)
            )
        );
        //decode process data and adds document to case
        $url1 = "http://localhost:8081/bonita/API/bpm/caseDocument/";
        $context1  = stream_context_create($options1);
        $result1 = file_get_contents($url1, false, $context1);
        $response1 =  json_decode($result1);
        echo print_r($response1);




This is the reponse i get from the http request
( [id] => 12 [creationDate] => 2015-05-26 09:57:41.218 [author] => 4 [index] => -1 [contentMimetype] => [caseId] => 33 [description] => draft [name] => doc_Invoice [fileName] => document_1.png [isInternal] => true [submittedBy] => 4 [url] => documentDownload?fileName=document_1.png&contentStorageId=12 [contentStorageId] => 12 [version] => 1 )

1 个答案:

答案 0 :(得分:0)

我明白了。除了bonita租户文件夹外,Bonita限制访问您使用的每条路径