samedi 27 juin 2015

Upload files to Google Drive using Dropzone

This is my current code used for the uploading task:

$imagesDropzone.dropzone
  init: ->
    this.on 'sending', (file, xhr) ->
      xhr.setRequestHeader 'Content-Type', file.type

  url: 'http://ift.tt/1nDTxXQ'
  method: 'post'
  maxFileSize: 5
  paramName: 'images-dropzone-input'
  headers:
    'Authorization': "Bearer #{ uploadBundle.accessToken }"
  addRemoveLinks: 'dictRemoveFile'

And it doesn't work (all uploaded files are broken). I know I need to do something like this:

xhr.send file

But I don't know where to put this call. How can I override the send behavior of Dropzone?

Aucun commentaire:

Enregistrer un commentaire