cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in hearing how one of our Community members uses Dropbox for sailing trips? Read all about it here.

Discuss Dropbox Developer & API

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

Dropbox API with PHP get content of file in Dropbox

Dropbox API with PHP get content of file in Dropbox

annahernandez99
Explorer | Level 4

 

I have a WebApp that stores a backup in the cloud of the user. I use the third party libary: http://fabi.me/en/php-projects/dropphp-dropbox-api-client/

I think Login works. But im stuck at the point where I can download it.

The following code downloads the file on the cloud and writes it to a file.

$dropbox->DownloadFile( $file, $test_file )
But I need the content of the file only in a string and not as file. The data shouldn't be stored.

1 Reply 1

Greg-DB
Dropbox Staff

When using the Dropbox API to download a file, that is, via /2/files/download, if the call is successful the file data is returned in the response body. Exactly what the client does with that is up to the client.

 

For example, in this case, it sounds like you're using a third party library to perform the download and that library saves the data from the response body to a local file, but you actually want it in memory as a string. We can't provide support for third party libraries like this, as they're not made by Dropbox. You may want to refer to the documentation for that library to see if it offers an option that does what you want. Otherwise, you may need to instead read the file off the local filesystem.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?