Is there any way of getting the UUID just after upload so I can have a dynamically loaded feed of images?
Hi @aire2100, thanks for your question. Yes, you can do that using the JS API of the uploader
// get a widget reference
var widget = uploadcare.Widget('[role=uploadcare-uploader]');
// listen to the "upload completed" event
widget.onUploadComplete(function (fileInfo) {
// get CDN URL from file information. Here you can generate a thumbnail using the file URL, save the URL to DB, etc. File UUID and other info can be extracted from fileInfo as well
console.log(fileInfo.cdnUrl);
});
When it comes to multiple file uploading, you can use the onChange()
method instead
// get a widget reference
var widget = uploadcare.Widget('[role=uploadcare-uploader]');
widget.onChange(function(group) {
// get an array of files
group.files().forEach(function(file) {
// get CDN URL from file information. Here you can generate a thumbnail using the file URL, save the URL to DB, etc. File UUID and other info can be extracted from fileInfo as well
file.done(function(fileInfo) {
console.log(fileInfo.cdnUrl);
});
});
});
Check out this live demo