2
votes

Hi I have a problem when I can try to upload a file with properties and metadata to alfresco 5.2 using php 5.4.3, this is my code:

  curl_setopt_array($curl, array(
        CURLOPT_PORT => "8080",
        CURLOPT_INFILESIZE => filesize($lo_document['tmp_name']),
        CURLOPT_URL => "http://localhost:8080/alfresco/api/default-/public/alfresco/versions/1/nodes/-root-/children",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_POSTFIELDS => $pam['body'],
        CURLOPT_HTTPHEADER => array(
            "authorization: ".$la_auth['Authorization'],
            "accept: application/json",
             "content-type: multipart/form-data"
        )
));

$pam['body'] is like this:

-----------------------60061ddb32c3445516be40d631852702
Content-Disposition: form-data; name="name"

patatas.pdf
-----------------------60061ddb32c3445516be40d631852702
Content-Disposition: form-data; name="nodeType"

mutua:documentoMutualista
-----------------------60061ddb32c3445516be40d631852702
Content-Disposition: form-data; name="filedata"; filename="CS-08940-00227056-1.pdf"
Content-Type: application/pdf

-----------------------60061ddb32c3445516be40d631852702--


This show this error:

{"error":{"errorKey":"No disk space available","statusCode":409,"briefSummary":"05140331 No disk space available","stackTrace":"For security reasons the stack trace is no longer displayed, but the property is kept for previous versions","descriptionURL":"https://api-explorer.alfresco.com"}}

But this error means one parameter or more are wrong but I don't know which,Server has a lot of disk space.

Any help? anybody works with ApiRest Alfresco 5.2 and PHP?

1
Are you sure you have space where your "alf_data" folder is, on your database server and so on? Have a look at this issue, are you sure you post your body ok? issues.alfresco.com/jira/browse/REPO-24Lista
Hi thanks for the answer, I can upload files with POSTMAN and with CURL in cmd console, but I can't do it the same with PHP, so I discard this possibilitydgonzalez

1 Answers

1
votes

I had a similar issue uploading a file with JavaScript in a browser environment where status 409 with an errorKey No disk space available was returned from the alfresco backend, but the same POST request in Postman or CURL worked without problems.

The solution was to not add the HTTP header "content-type: multipart/form-data", because it already contained an multipart/form-data; boundary=---------------------------41184676334 header, if no custom content-type header was added.

Refrences: