Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
hayk
9 years agoExplorer | Level 4
The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*'
Hey guys I am using npm package to work with dropbox. However when I try to upload a file I get the following error XMLHttpRequest cannot load https://content.dropboxapi.com/2/files/upload. Respo...
- 9 years ago
I used an example Meteor app, and in server/main.js I just used the node library normally:
var Dropbox = require('dropbox');const dbx = new Dropbox({accessToken: "<ACCESS_TOKEN>"}) dbx.filesUpload({path: "/test_207235.txt", contents: "some test data"}) .then(function (response) { console.log(response) }) .catch(function (error) { console.error(error) })That uploaded the file successfully. Attempting the same in client/main.js failed with the same error you got.
I don't have a more advanced sample available though. The filesUpload method takes a string or buffer, but beyond that I'm afraid I can't offer much insight as to how to manage files/data in node and Meteor themselves.
If you want to upload directly from the user's browser, you can use the JavaScript SDK in the browser's JavaScript. E.g., include the library via a script tag in your HTML, and run JavaScript from a script tag, as shown in the basic browser example.
Greg-DB
Dropbox Community Moderator
9 years ago
I used an example Meteor app, and in server/main.js I just used the node library normally:
var Dropbox = require('dropbox');
const dbx = new Dropbox({accessToken: "<ACCESS_TOKEN>"})
dbx.filesUpload({path: "/test_207235.txt", contents: "some test data"})
.then(function (response) {
console.log(response)
})
.catch(function (error) {
console.error(error)
})
That uploaded the file successfully. Attempting the same in client/main.js failed with the same error you got.
I don't have a more advanced sample available though. The filesUpload method takes a string or buffer, but beyond that I'm afraid I can't offer much insight as to how to manage files/data in node and Meteor themselves.
If you want to upload directly from the user's browser, you can use the JavaScript SDK in the browser's JavaScript. E.g., include the library via a script tag in your HTML, and run JavaScript from a script tag, as shown in the basic browser example.
hayk
9 years agoExplorer | Level 4
Hi dear Greg,
I found the way to upload my file. The problem was in the way I was creating the buffer. So now I am able to upload from my server. I'm putting a gist here in case anyone will need it.
https://gist.github.com/hayk94/2a11702a3476f49bd65e36e7fa715d90
Though now I need to get a link of the image to show it in my HTML and there seems to be no way to do that programmatically, but I think that is another story therefore I created a new topic https://www.dropboxforum.com/t5/API-support/Share-and-get-the-link-via-api/m-p/208116#M10220
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!