uploader

Hi all,
is there a way or any event to get the list or even the number of files being selected before the ‘onAfterFileAdd’ occurs?
regards

The properties of the uploaded files are stored in the uploader files Data Collection that contains an object of file objects.

To get to all files currently added to the uploader body, apply the following code:

// "upl1" - uploader ID
$$("upl1").files.data.pull;

The line returns an object with uploaded data items (files). Each file item contains information about its size, type, status, etc. <a href “https://docs.webix.com/desktop__file_upload.html#manipulationswithfiles”>Here is more information.

onBefore/onAfterFileAdd works only for each distinct item. Accordingly, the number of files in the list on the client grows on each onAfterFileAdd
Using <a href = "https://docs.webix.com/api__ui.uploader_autosend_config.html">autosend</a>(enable seding files to server immediately after they have been added to uploader) there’s no way to catch the moment when all files are added and ready for uploading. Cancelling autosending (autosend:false in configuration) allows users to looks through the files ready for uploading before sending them to server to avoid human errors.

autosend is already set to false,
$$(“upl1”).files.data.pull; returns the object one by one after the ‘onAfterFileAdd’ event. So only at the end I have the right files name & count. What I need is to know this count before the above event. I did not find any way to do this. Any other suggest/idea?

@kappa https://webix.com/snippet/939eabb1
will not work with old browsers

When you use onBeforeFileAdd you can get the count of files that were already added to the uploader (without the current file) , and in onAfterFileAdd event the hash of files includes the current file. Also, you can return false in onBeforeFileAdd to prevent adding.
Here is an example: https://webix.com/snippet/a904b562