question about Groups


I just register and try the service and have a question about Groups.

With the standard JS uploader ( by the way, Very Good Work :slight_smile: ), if I set data-multiple=“false”, the field is populated with value like:

The url is public, can be reached without an API call, and contain a UUID for the file, it is straightforward.

With data-multiple=“true” the field is populated with value like:

This is UUID for Group, I must execute the API call:

to parse the JSON result to get individual files UUIDs.

My question is - is it possible somehow, for the field to be populated with the individual files UUIDs separated by a comma for example?

If this is not possible, I must implement some sort of backend logic to extract these individual files - before the user send the form ( with hooks ) or after sending it, maybe even to write a job in the queue, trigger an event, or cronjob.

All of these solutions require additional time and it is possible for the user to not see the uploaded images after the form is submitted.

Give me your opinion about your experience with best practices in cases like this?

Hey @radosslav,

The easiest way to access individual files from a group is to use the /nth/ operation. See the docs

Also, you can use the Widget’s API to obtain a list of individual real CDN URLs from a filegroup. Check out this demo to see how you can use it to create additional fields in a form and populate them with CDN URLs extracted from a multi-upload:

1 Like

Thank you, Alex!

This code example is Exactly what I expect and need for Multi Uploads!

And for the Group URL, the number after the ~ is actually the number of the files in this group - I can simply get them with a simple while loop when I know the total count of the files.

Initially, because I test with 1 and 2 files, I think is some sort of internal/incremental number, but the real proposal is really useful, because this is a really clever approach, and does not require API calls!

1 Like