Skip to content

Instantly share code, notes, and snippets.

@alecguintu
Last active August 29, 2015 14:05
Show Gist options
  • Save alecguintu/0fa3b183767d354d3289 to your computer and use it in GitHub Desktop.
Save alecguintu/0fa3b183767d354d3289 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)
console.log 'Sending file...'
console.log pick_fpfile
filepicker.store pick_fpfile, store_options, (store_fpfile) ->
console.log 'Callback of file...'
console.log pick_fpfile
# Remove files from both fp.io and our root s3 path
filepicker.remove pick_fpfile, {policy: security.policy, signature: security.signature}
# Result
# Sending file... upload_audio.js?body=1:56
# Object {url: "https://www.filepicker.io/api/file/Ag5tYqvtSJGOxmbSRX2z", filename: "test copy.mp3", mimetype: "audio/mp3", size: 725240, key: "Owigs5gHRjeM9fcI7IQ7_test copy.mp3"…} upload_audio.js?body=1:57
# Sending file... upload_audio.js?body=1:56
# Object {url: "https://www.filepicker.io/api/file/N4ryFjCTqqrsWCWvZV2w", filename: "test.mp3", mimetype: "audio/mp3", size: 725240, key: "x7obxPH0TfKc9ImnV5oA_test.mp3"…} upload_audio.js?body=1:57
# Callback of file... upload_audio.js?body=1:60
# Object {url: "https://www.filepicker.io/api/file/N4ryFjCTqqrsWCWvZV2w", filename: "test.mp3", mimetype: "audio/mp3", size: 725240, key: "x7obxPH0TfKc9ImnV5oA_test.mp3"…} upload_audio.js?body=1:61
# Callback of file... upload_audio.js?body=1:60
# Object {url: "https://www.filepicker.io/api/file/N4ryFjCTqqrsWCWvZV2w", filename: "test.mp3", mimetype: "audio/mp3", size: 725240, key: "x7obxPH0TfKc9ImnV5oA_test.mp3"…} upload_audio.js?body=1:61
# POST https://www.filepicker.io/api/file/N4ryFjCTqqrsWCWvZV2w/remove?_cacheBust=1409712922428 404 (NOT FOUND)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment