When using upload widget, I received a return value like this: {"filename":"1.txt","tempPath":"tmp_17017649110811510037.txt","contentType":"text/plain"}
Searching the server's folder, I found it in folder "\workspace\tomcat\server\temp\bonita_portal_5212@{computer name}\tenants\1".
Is there anyway to dynamically access this file and folder in the Groovy script?
Thanks in advance,
EDIT: As ask below, my case is that user will be allow to upload a text file that is actually a CSV or TSV data file that will appear as link in following tasks, as well as overview page. Before user can submit the form, and save the file to server, they are required to click a button to send the file to a Bonita REST API (Groovy script) that will verify the file and return the result. In this stage, the file is stored in a temporary folder on Bonita folder. I want to, in the REST API Groovy script file, accept a parameter as tempPath value, then access the file in temporary folder, in order to read and check the file data. My problem is how to dynamically access the folder, as the folder name seem to change with each restart.
Thank you for the detailed use case.I now understand your Use case.
I had long back developed a custom REST API that basically check if a file is in correct Excel format .
For this use case ,
You need to modify the Existing Upload widget. Change the Url from API/formFileUpload to your custom REST API.
that custom Widget is now only going to validate.
You need to develop your Own custom REST API. You need Java knowledge. You can refer online forum for the same.
Use the Bonita Studio to create your Own custom REST API. As Input Parameter , pass your Text file. Perform your File validation using Java code inside REST API. Return some output from that custom REST API.
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.