How to upload a file from Angular Application to Bonita process

Hello, I am building a Angular + Bonita application.


I am trying to upload a file from Angular app to Bonita process.
Is there any example on how to achieve the same.

According to Bonita Upload widget , we need to have below parameters for each document.
{"filename":"order.png","tempPath":"tmp_5772107524853072400.png","contentType":"image/png"}}

I can pass the name and type from angular but not sure how to generate the temp path. If I pass the File in tempPath i am getting error

{"exception":"class java.lang.ClassCastException","message":"java.util.LinkedHashMap cannot be cast to java.lang.String"}

 

Any help would be helped.

 

regards

 

Hello

the Solution is to first Upload only the files using a REST API 

http://localhost:8080/bonita/portal/imageUpload . You need to pass the X-API -Token along with the FormData.
The Response will be a tmp_path.

Now create a variable using { name , tmppath , content type }
Pass this variable along with contract input. 

refer this link
https://github.com/Bonitasoft-Community/example-upload-servlet


that will solve the problem.

after trying several documents , what i found is only png , jpeg , jpg are supported.
Any pdf and excel or word document is not supported.

 

For trying to upload any format , you need to use bonita/API/formFileUpload

https://documentation.bonitasoft.com/bonita/2021.2/api/manage-files-using-upload-servlet-and-rest-api
I am still struggling with formFileUpload. Not able to get the tmppath as response.

 

Regards

 

Hello,

Going through the documentation about dealing with document upload, I guess the Servlet you are looking for is /portal/fileUpload

The imageUpload, as its name suggests is only able to handle images.

 

Hope This helps,

Captain Bonita

Hello captain


Thanks for pointing the correct servlet.

My issue is resolved. I am able to upload files of different formats.