FileUploadField and FileMultiUploadField

Hello,

  1. I am trying the FileMultiUploadField, and how to create the popup exactly at the documentation example?

https://doc.cuba-platform.com/manual-6.10/gui_FileMultiUploadField.html

  1. For FileUploadField or FileMultiUploadField, how to override their behavior so that they do not automatically upload and save the file/s to the database? I would like to add a button that when clicked does the actual upload. What happens right now is it automatically uploads the file just by selecting it from the file explorer. I tried to add fileStoragePutMode="MANUAL" to no avail.

Thanks.

Hi,

fileStoragePutMode - defines how the file and the corresponding FileDescriptor are stored.

  • In the IMMEDIATE mode it is done right after uploading file to the temporary storage of the client tier.
  • In the MANUAL mode, you should do it programmatically in a FileUploadSucceedListener.

So, if you define fileStoragePutMode="MANUAL", then a file is uploaded only into temporal storage and isn’t stored in a DB. You can an additional button to put a file into storage. Also, you can remove a temporal file if another one is selected by using com.haulmont.cuba.gui.upload.FileUploadingAPI#deleteFile.

Regard,
Gleb

Hi Gleb @gorelov,

Is there any way that the file won’t even be uploaded to the temporal storage?

Unfortunately, there is no way to prevent loading into temporary storage.

Ok, I think that’s a relatively minor issue only.

I managed to add a button that transfers the file from temporary storage to file storage, and now, is there are way to reset or re-initialize the FileUploadField after a successful upload? If possible remove the file name displayed on the screen? Something like this.

Try fileUpload.setValue(null)

It’s working! Thank you very much for all the help @gorelov!