Read input from ../API/formFileUpload



I am using upload Widget to upload a CSV File.

The URL is the default : "../API/formFileUpload"

I am using a JS script to getting the uploaded document value (inside my Form) .

When the file is uploaded. I can access to theses information :

filename: "my_test.csv"
tempPath: "tmp_14768815780437769952.csv"
contentType: "text/csv"

However I am not able to READ the uploaded file.
I have no clue how to do it ( and how to do it the best way possible )

So far I am just able to see the 3 informations above ( filename / tempPath & contentType )
Any help will be HIGHLY appreciated, I have been struggling for more than one week with this issue.

1 answer

This one is the BEST answer!


That service /API/FormFIleUpload, is pushing the file on server side, and you are client side. By definition you will not be able to access it.

I see 2 different scenarios to have this need :

* Validate the content of the file (or similar) before allowing submission of the task and be handle (the file) by the process

* Use the file only on frontend to extract data or similar

For first use case, (assuming it is a different validation by form/process...) I will go for a new Servlet (tomcat) that will validate the content and then do a redirect to the FormFIleUpload servlet, your form will call this new servlet.

In front end, I will do that in a customWidget, see this angularjs example:


Submitted by sabbe.kev_1422207 on Mon, 04/20/2020 - 03:58

Thank you very much,
Will try this way

You got a point, I actually don't need to upload my file ( just be able to read it )
I will wait until the end of the week to validate your answer

Submitted by sabbe.kev_1422207 on Mon, 04/20/2020 - 05:02

Do you have more practicail example how can I implement this code inside my custom widget? I don't have much in experience in Bonita nor Angular, thank you in advance