2015-05-26 63 views
0

我在php中創建了這個http請求,發送一個上傳的文件到bonitasoft,我從http請求沒有錯誤,並且我成功將文件上傳到了我的電腦,但不知怎的,bonitas軟件通過這個請求獲得一個空文件。我不能使用CURL。Http請求發送空文件

$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) 

回答

0

我想通了。 Bonita限制訪問您使用的所有路徑,除了bonita租戶文件夾