Skip to content

Instantly share code, notes, and snippets.

@alecguintu
Last active August 29, 2015 14:05
Show Gist options
  • Save alecguintu/971eb66d020803b2d9c3 to your computer and use it in GitHub Desktop.
Save alecguintu/971eb66d020803b2d9c3 to your computer and use it in GitHub Desktop.
Filepicker pickMultiple -> store -> remove
filepicker.pickMultiple picker_options, (pick_fpfiles) ->
for pick_fpfile, i in pick_fpfiles
sanitized_filename = sanitize_filename(pick_fpfile.filename)
filepicker.store pick_fpfile, store_options, (store_fpfile) ->
# Remove files from both fp.io and our root s3 path
# Here's where the problem happens. pick_fpfile is always the last from the list of pick_fpfiles since filepicker.store is asynchronous and pick_fpfile has already changed by the time the filepicker.remove's success callback has returned
filepicker.remove pick_fpfile, {policy: security.policy, signature: security.signature}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment