vue-dropzone icon indicating copy to clipboard operation
vue-dropzone copied to clipboard

manuallyAddFile not sending custom Authorization header

Open DaanGeurts opened this issue 6 years ago • 3 comments

At first I like to say, thanks for all the hard work @rowanwins and all the others!! I'm using your package and it works perfectly except for one thing. I'm having the same problem as above. I've set my config as below:

options = {
    url: process.env.API_URL + '/workers/documents/' + this.documentUploadUrl,
    headers: {
      Authorization: this.$auth.getToken('local'),
    },
    maxFilesize: 2, // MB
    maxFiles: 1,
    addRemoveLinks: true,
  }

and when I'm calling this:

var thumbnail = {
      name: this.document.name,
      size: this.document.size,
      type: this.document.mimeType,
      accepted: true,
    }

    let dropZone = this.$refs[this.document.type] as any
    dropZone.manuallyAddFile(thumbnail, this.documentUrl)

The header is not set. But when I drag a file on the dropzone the upload request has the custom header set.

Originally posted by @DaanGeurts in https://github.com/rowanwins/vue-dropzone/issues/178#issuecomment-443229468

DaanGeurts avatar Jan 23 '19 13:01 DaanGeurts

Is you manuallyAddFile actually resulting in the send files being sent? Normally it's been used for pre-seeding the dropzone area with files but not actually uploading them...

rowanwins avatar Jan 24 '19 05:01 rowanwins

It's not uploading the added files but it tries to fetch the image from the server ( this.documentUrl ), probably for a preview. But this (this.documentUrl) endpoint is secured so I need to send the Authorization header with the request.

DaanGeurts avatar Jan 30 '19 06:01 DaanGeurts

@DaanGeurts did you solve this?

askdesigners avatar Apr 24 '20 21:04 askdesigners