cancel
Showing results for 
Search instead for 
Did you mean: 

File Upload Error

helmi_brahem
Champ in-the-making
Champ in-the-making

Now I'm trying to upload file using the #RestApi. I use the Web Script /alfresco/service/api/upload but i'm receiving an error 500(internal error):‌An error inside the HTTP server which prevented it from fulfilling the request.

 

File Upload

                           

POST /alfresco/service/api/upload

Upload file content and meta-data into repository.
HTML form data

    * filedata, (mandatory) HTML type file
    * siteid
    * containerid
    * uploaddirectory
    * updatenoderef
    * filename
    * description
    * contenttype
    * majorversion
    * overwrite
    * thumbnails

4 REPLIES 4

janv
Employee
Employee

Hi,

Can you please provide the complete stacktrace and exact details about your deployed environment (including versions etc) ?

Also, I'd recommend switching to the public V1 REST API to upload content (rather than using the v0 web script):

Alfresco Content Services REST API Explorer

Regards,

Jan

helmi_brahem
Champ in-the-making
Champ in-the-making

Hi, 

We are currently using  Alfresco  v 5.2 that we have deployed on a Tomcat server.

We are working with angular 6 . we are  in fact using Alfresco JS API library, but we could not found a way to upload a new version of the uploaded file. this pushed us to use the v0 web script as shown below.

POST /alfresco/service/api/upload

 

Upload file content and meta-data into repository.
HTML form data

 

    * filedata, (mandatory) HTML type file
    * siteid
    * containerid
    * uploaddirectory
    * updatenoderef
    * filename
    * description
    * contenttype
    * majorversion
    * overwrite
    * thumbnails

In order to call the web script, we are using the function below.

export interface WebscriptApi {
new(client: ApiClient): WebscriptApi;

executeWebScript(httpMethod?: string, scriptPath?: string, scriptArgs?: any, contextRoot?: string, servicePat?: string, postBody?: string😞 Promise<{}>;
}
And thank you for your answer

abhinavmishra14
World-Class Innovator
World-Class Innovator

Can you provide the request format and parameters you are passing in the request? Please provide the complete logs as well (alfresco.log/catalina.out etc.)

All the parameters that you have mentioned above are not always required. They are used as per need. for example 'updatenoderef' is required when you want to upload a new version to an existing node and you should already know the existing object's nodeRef. 

If you are calling the rest api from code, you can refer here to get some idea as to how the params are passed: https://javaworld-abhinav.blogspot.com/2014/09/upload-documents-to-alfresco-using-rest.html

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

helmi_brahem
Champ in-the-making
Champ in-the-making

Hi,

The issue we have is in the FrontEnd. We are working with angular 6 . We are using both Alfresco JS API library and the v0 web script  as shown below to upload a new version an old file. The web scripts are deployed on a tomcat server.

The v0 web script :

 

POST /alfresco/service/api/upload

 

Upload file content and meta-data into repository.
HTML form data

 

    * filedata, (mandatory) HTML type file
    * siteid
    * containerid
    * uploaddirectory
    * updatenoderef
    * filename
    * description
    * contenttype
    * majorversion
    * overwrite
    * thumbnails

In order to call the web script, we are using the function below.

export interface WebscriptApi {
new(client: ApiClient): WebscriptApi;

   // Alfresco-JS-API function
executeWebScript(httpMethod?: string, scriptPath?: string, scriptArgs?: any, contextRoot?: string, servicePat?: string, postBody?: string😞 Promise<{}>;
}

Is there a better way to fix our issue while still working FrontEnd.

And thank you for your previous answer.