How to only accept ".pdf" format for file upload in bonitasoft?

i use bonita soft 2022.2

i want the upload widget accept only pdf extension, how to specify that ?

and how to use the property "Error on upload holder" in the right panel of the upload widget ?

 

Hi,

you can create your own custom widget from the upload widget and add a property to configure the accept attribute the

<input type="file" accept="{{ properties.accept }}" .../>

The Error on upload holder can be bound to a variable to display an error message to your users if the upload goes wrong.
By using the Hidden property on a text by example. Here is a small example

For a server side validation, you will have to customize the bonita webapp web.xml file from the Tomcat Bundle.
It should be possible to define a specific servlet (and its servlet-mapping) with the desired SupportedExtensions parameter.

<code lang=xml">

pdfUploadServlet
org.bonitasoft.console.common.server.servlet.TenantFileUploadServlet

SupportedExtensions
pdf


ContentType
json




pdfUploadServlet
/API/pdfUpload

HTH
Romain

1- I’ve done this before, I’ve already added "accept" attribute , but this is just a front side validation, the user can easily change the file type, i wonder if can i use the server side validation?

2- Can you give me an example of using "Error on upload holder", can I use it to manage the file in pdf format?

I have updated the answer, Error on upload holder can be used to retrieve the server error response.

HTH
Romain