vue-dropzone
vue-dropzone copied to clipboard
manuallyAddFile not sending custom Authorization header
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
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...
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 did you solve this?