Hi everyone. I have react app in which I have implemented uppy dashboard with plugins like google drive and dropbox, it reads files fine, but when i try and use XHR to upload file from lets say dropbox to my server via API it gives me error 400 “upload destination does not match any allowed destinations”. Im not sure is this possible at all, or am I just missing some permissions configuration. Any help is appriciated!
Here is my react implementation:
import Uppy from '@uppy/core';
import XHR from '@uppy/xhr-upload';
import RemoteSources from '@uppy/remote-sources';
import { Dashboard } from '@uppy/react';
import { COMPANION_URL } from '@uppy/transloadit';
const [uppyDashboard] = useState(() =>
new Uppy({
restrictions: {
allowedFileTypes: [".psd"],
maxNumberOfFiles: 1,
maxFileSize: 157286400,
},
locale: {
strings: {
dropPasteImportBoth:
"%{browse} or Drag and Drop your file from your device or upload from cloud",
browseFiles: "Click here",
poweredBy: "",
},
},
})
.use(RemoteSources, {
companionUrl: COMPANION_URL,
sources: ["Dropbox", "GoogleDrive", "OneDrive"],
})
.use(XHR, {
method: "POST",
endpoint: "path-to-my-custom-api-where-i-store-file",
headers: {
Authorization: `Bearer ${localStorage.getItem("accessToken")}`,
},
formData: true,
fieldName: "psd_file",
limit: 1,
})
.on("complete", (result) => {
console.log("complete: ", result.successful);
})
.on("upload-error", (result) => {
console.log("upload-error: ", result);
})
.on("error", (result) => {
console.log("error: ", result);
})
);