How to get the name of a file uploaded in a document

Hello,

my process uploads a file (xlsx, csv or txt) via the instantiation form in a document, using the UPLOAD widget.
Let's say, for example, that I select the file "Conso_data_2020_03.xlsx".

The document declared at the pool level is called "myConsoDataFile".

In a process task, I want to copy this file to a different directory than the original one.
To do this, I download the document by applying the following script, found on this forum:

    import org.bonitasoft.engine.api.ProcessAPI;
    ProcessAPI processAPI = apiAccessor.getProcessAPI ();
    byte [] content = processAPI.getDocumentContent (myConsoDataFile.getContentStorageId ());
    FileOutputStream fos = new FileOutputStream (path + "result.xlsx");
    fos.write (content);

"path" is a variable initialized by the destination path of my file ("c:\project\conso\data\")

This script works well, but, as you can see, the downloaded file is always named "result.xlsx".
I want to give the new file the same name as the original one.

How can I get the name of the original selected file, and give it to the new one ?

In advance, thank you for your answers,

Thierry

found myself the answer.

Quite easy after all :

FileOutputStream fos = new FileOutputStream(path+ myConsoDataFile.contentFileName);