We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
Sega
7 years agoNew member | Level 2
filesUpload gives corrupted file
Hello, I'm want to use the Dropbox API/SDK in one of my projects. I have to convert a base64 string I'm getting from my webcam as a screenshot into a real image and then upload it to Dropbox. (I'...
- 7 years ago
I believe you should just supply the buffer directly, so all you need to do is:
const base64File = this.webcam.getScreenshot() const dbx = new Dropbox({ accessToken: this.state.dropboxToken }) const i = base64File.indexOf('base64,') const buffer = Buffer.from(base64File.slice(i + 7), 'base64') const name = 'test.png' dbx.filesUpload({path: '/' + name, contents: buffer}) .then(function (response) { console.log(response) }) .catch(function (error) { console.error('dropbox error', error) })
Greg-DB
7 years agoDropbox Staff
I believe you should just supply the buffer directly, so all you need to do is:
const base64File = this.webcam.getScreenshot() const dbx = new Dropbox({ accessToken: this.state.dropboxToken }) const i = base64File.indexOf('base64,') const buffer = Buffer.from(base64File.slice(i + 7), 'base64') const name = 'test.png' dbx.filesUpload({path: '/' + name, contents: buffer}) .then(function (response) { console.log(response) }) .catch(function (error) { console.error('dropbox error', error) })
- Sega7 years agoNew member | Level 2That was it! Thanks!
Stupid that i just tried the two options and not the third option..
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,878 PostsLatest Activity: 6 hours agoIf 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 or Facebook.
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!