Raix:ui-dropped-event with cfs, limit user images


I’m having some trouble understanding how to limit the number of images a user can have, with raix:ui-dropped-event and CollectionFS.

// Catch the dropped event
'dropped #dropzone': function(event, temp) {
  console.log('files droped');

  // If using the cfs api
  FS.Utility.eachFile(event, function(file) {
    var id = images.insert(file);
    console.log('Inserted file ');

So I was thinking I can limit the upload each time to 1 image file, and stop the upload if there are already 6 at the server. However, I’m not sure how I could know what the upload files length is here (e.target.files is not it).

Even better is if I could allow multiple uploads, but the server will know to block the upload if the user already has 6. I’m not sure how though as the inserts are async.