You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
PHDev
7 years agoExplorer | Level 3
Upload Image Base64 Encoded with Dropbox API
Hi, I'm trying to use dropbox API for uploads images, actually I have the Base64 encoded string of image file and I wanna use the API for upload. I try this but it doesn't work.
curl -X POST https://content.dropboxapi.com/2/files/upload \ --header "Authorization: Bearer <TOKEN>" \ --header "Dropbox-API-Arg: {\"path\": \"/test/img.jpg\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}" \ --header "Content-Type: application/octet-stream" \ --data-binary "<Base64 Encoded Image Here>"
I wanna know if I can upload images encoded in Base64.
Thanks.
- chirstiusDropbox Staff
Hello PHDev,
Can you clarify if you are trying to store the literal Base64 encoding or if your end goal is to upload Base64 and have Dropbox store the resulting image that the Base64 data represents?
Base64 conversion is not supported by the upload API endpoints. So if you are trying to store the resulting images, you will need to "reconstitute" the image file back to its binary format before you upload it.
If instead, you are trying to store the literal Base64 encoding of the image, you will still need to convert that data to bytes before uploading it and then decode it when you pull it back down.
Hope that helps,
-Chuck
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,888 PostsLatest Activity: 24 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!