Uploading many files in one go

  • This documentation is for the version 3.2.1 of the widget. If you're looking for the widget v2 docs, check here.

Multi-file uploads

Often, you want users to upload sets of files, not just single ones. This is done by adding the data-multiple attribute to your input with the specified role, role="uploadcare-uploader">. The boolean attribute should be set to true. This will let users to choose and upload many files in one go,

<input type="hidden" role="uploadcare-uploader" name="multifile"
  data-multiple="true"
/>

The files are then stored as a [file-group][cdn-group], and you get a group_id instead of the UUID in the value. Group IDs look like this:

088de3b6-c5f2-4f56-9e9c-87b0b960286e~3

Such IDs resemble UUIDs but have a number after ~. The number stands for the number of files in that group. If you are not using [autostore][widget-autostore], you can store this group in the same way as a single file via an [API request][api-rest-group].

group_id can then be used to get any single file in a group from CDN,

http://ucarecdn.com/088de3b6-c5f2-4f56-9e9c-87b0b960286e~3/nth/0/
http://ucarecdn.com/088de3b6-c5f2-4f56-9e9c-87b0b960286e~3/nth/1/
http://ucarecdn.com/088de3b6-c5f2-4f56-9e9c-87b0b960286e~3/nth/2/

All [media processing][processing-home] operations are supported by this scheme,

http://ucarecdn.com/088de3b6-c5f2-4f56-9e9c-87b0b960286e~3/nth/0/-/scale_crop/300x300/center/

Note, when trying to access a Group ID via a browser, you will see a list of individual file UUIDs in this group.