Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
HRania
5 years agoExplorer | Level 3
Display image from Dropbox to a webpage
So, I am trying to display an image on my web application. I am getting this image from a Dropbox folder. I want to get a URL I could use to show the image in HTML using the src attribute.
I have written this code:
function downloadFile() {
var Dropbox = require('dropbox').Dropbox;
var ACCESS_TOKEN = "XXXXXXXXXXX"; // Here the access token key
var dbx = new Dropbox({ accessToken: ACCESS_TOKEN });
dbx.filesDownload({ path: '/desiredImg.jpg' })
.then(function(response) {
var results = document.getElementById('results');
var img = document.createElement('img');
img.src=window.URL.createObjectURL(response.fileBlob);
console.log(response);
console.log(response.fileBlob);
})
.catch(function(error) {
console.error(error);
});
return false;
}
Result
Result
Error
error
Can anyone help me figure this out?
[Cross-linking for reference: https://stackoverflow.com/questions/67710163/display-image-from-dropbox-to-a-webpage ]
I see from your StackOverflow post that you already sorted this out.
2 Replies
- Greg-DB5 years ago
Dropbox Community Moderator
[Cross-linking for reference: https://stackoverflow.com/questions/67710163/display-image-from-dropbox-to-a-webpage ]
I see from your StackOverflow post that you already sorted this out.
- HRania5 years agoExplorer | Level 3
Yes, Thank you
I Forgot to mention that .
About Discuss Dropbox Developer & API
Make connections with 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!