cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We love to hear how every person gets the most from Dropbox, and it seems everyone has a slightly different use for it - tell us yours here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to save pictures inside an array and then display

How to save pictures inside an array and then display

haso94
Explorer | Level 3

Hi,

 

In my vue application I am trying to download pictures from my dropbox account. So far I can get the metadata but I want to get the images and save them inside an array and then display them on my application. How could I do that? This is my code to download / get the information.

getImages() {
const Dropbox = require("dropbox").Dropbox;
let pictures2 = [];
const dbx = new Dropbox({
accessToken: 'ACCESS_TOKEN'
});
dbx.filesDownload({
path: "/test/road-6576857_1920.jpg"
}).then(function(response) {
console.log(response)
},
)}

 

5 Replies 5

Re: How to save pictures inside an array and then display

Greg-DB
Dropboxer

[Cross-linking for reference: https://stackoverflow.com/questions/69320818/how-to-download-dropbox-pictures-locally-to-a-folder-wi... ]

 

Exactly how you save/display them depends on your app/environment, but the filesDownload method is the right way to download a file's data from Dropbox. You can get the resulting data from the response as shown in this example for a browser environment, and this example for a node environment.

Re: How to save pictures inside an array and then display

haso94
Explorer | Level 3

Thanks for the reply. The one for the browser does not open, I looked at the one for the node environment but the problem is, that I do not have FileBinary for example and name is only accessible in my case with response.result.name. Is it due to the different methods we use?

Re: How to save pictures inside an array and then display

Greg-DB
Dropboxer

Apologies, I've fixed the first link.

 

Depending on the type of environment, the file data itself will be available in either the object's 'fileBlob' or 'fileBinary' property.

Re: How to save pictures inside an array and then display

haso94
Explorer | Level 3

Thanks, if I understood the example correctly. The shown method downloads the file from a url but this would be different from my usecase. I want to download it directly from inside a folder to a local folder in my project. For example if I log the response I am getting I can see the FileBlob in the console. But I can not access it from my code to do something like this for example: result.FileBlob what could be the error in this?

Re: How to save pictures inside an array and then display

Greg-DB
Dropboxer

Yes, those examples happen to use the sharingGetSharedLinkFile method, but accessing the result works the same way as filesDownload.

 

As for the latest issue, I see you opened a new forum thread and GitHub issue, so I'll follow up with you there.

Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    haso94 Explorer | Level 3
What do Dropbox user levels mean?
Need more support?