<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to download a file and save to local PC in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-download-a-file-and-save-to-local-PC/m-p/173011#M6629</link>
    <description>&lt;P&gt;In that case, you essentially have two options:&lt;/P&gt;
&lt;P&gt;1) Use &lt;A href="https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#_getFile" target="_blank" rel="nofollow noreferrer"&gt;getFile&lt;/A&gt;&amp;nbsp;to get the file content and pass&amp;nbsp;it down to the browser instead of saving it to disk. You'll still need to supply a valid resource as the $outStream parameter where the SDK can write the data though. How exactly you set that up it outside the scope of&amp;nbsp;Dropbox API support, and may depend on your web framework, so I can't offer much insight there.&lt;/P&gt;
&lt;P&gt;2) If you don't want to pass the data through your server, use&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#_createShareableLink" target="_blank" rel="nofollow noreferrer"&gt;createShareableLink&lt;/A&gt; or&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#_createTemporaryDirectLink" target="_blank" rel="nofollow noreferrer"&gt;createTemporaryDirectLink&lt;/A&gt;&amp;nbsp;to get a link to the file to give to the user in their browser.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jun 2016 03:08:00 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2016-06-28T03:08:00Z</dc:date>
    <item>
      <title>How to download a file and save to local PC</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-download-a-file-and-save-to-local-PC/m-p/173008#M6626</link>
      <description>&lt;P&gt;I am new to using php and dropbox, so this query may seem simple.&lt;/P&gt;
&lt;P&gt;My application is to integrate the ability to upload/download to a specified folder in my Dropbox.&lt;/P&gt;
&lt;P&gt;I can do the following in php (with the help of CodeCourse)&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;authenticate&lt;/LI&gt;
&lt;LI&gt;list my files in a given folder&lt;/LI&gt;
&lt;LI&gt;upload a file to a given folder&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I am struggling with how to download a file to my PC and save it.&lt;/P&gt;
&lt;P&gt;Code snippet:&lt;/P&gt;
&lt;P&gt;require_once "./dropbox-sdk/Dropbox/autoload.php";&lt;/P&gt;
&lt;P&gt;$children = $client-&amp;gt;getMetadataWithChildren($path);&lt;/P&gt;
&lt;P&gt;$docs = $children["contents"];&lt;/P&gt;
&lt;P&gt;# from the $docs array I can get the path to the required file&lt;/P&gt;
&lt;P&gt;# I then try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$outStream ='';&lt;/P&gt;
&lt;P&gt;$download = $client-&amp;gt;getFile($path,$outStream);&lt;BR /&gt;header("Content-type: " . $download["mime"]);&lt;BR /&gt;echo $download["data"];&lt;BR /&gt;exit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the headers may need to be improved but the first problem is that the getFile function errors as I am not initialising $outStream correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be appreciated&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:32:24 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-download-a-file-and-save-to-local-PC/m-p/173008#M6626</guid>
      <dc:creator>Adrian D.2</dc:creator>
      <dc:date>2019-05-29T09:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to download a file and save to local PC</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-download-a-file-and-save-to-local-PC/m-p/173009#M6627</link>
      <description>&lt;P&gt;It looks like you're using the&amp;nbsp;Dropbox PHP Core SDK. The tutorial for that covers downloading a file using the &lt;A href="https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#_getFile" target="_blank" rel="nofollow noreferrer"&gt;getFile method&lt;/A&gt; here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dropbox.com/developers-v1/core/start/php#downloading" rel="nofollow noreferrer"&gt;https://www.dropbox.com/developers-v1/core/start/php#downloading&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 00:57:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-download-a-file-and-save-to-local-PC/m-p/173009#M6627</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-06-28T00:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to download a file and save to local PC</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-download-a-file-and-save-to-local-PC/m-p/173010#M6628</link>
      <description>&lt;P&gt;Thank you , I had seen this but discounted it as it stores on my web server , whereas i really it want it served to my browser where the user can save to local disk ?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 01:42:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-download-a-file-and-save-to-local-PC/m-p/173010#M6628</guid>
      <dc:creator>Adrian D.2</dc:creator>
      <dc:date>2016-06-28T01:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to download a file and save to local PC</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-download-a-file-and-save-to-local-PC/m-p/173011#M6629</link>
      <description>&lt;P&gt;In that case, you essentially have two options:&lt;/P&gt;
&lt;P&gt;1) Use &lt;A href="https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#_getFile" target="_blank" rel="nofollow noreferrer"&gt;getFile&lt;/A&gt;&amp;nbsp;to get the file content and pass&amp;nbsp;it down to the browser instead of saving it to disk. You'll still need to supply a valid resource as the $outStream parameter where the SDK can write the data though. How exactly you set that up it outside the scope of&amp;nbsp;Dropbox API support, and may depend on your web framework, so I can't offer much insight there.&lt;/P&gt;
&lt;P&gt;2) If you don't want to pass the data through your server, use&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#_createShareableLink" target="_blank" rel="nofollow noreferrer"&gt;createShareableLink&lt;/A&gt; or&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#_createTemporaryDirectLink" target="_blank" rel="nofollow noreferrer"&gt;createTemporaryDirectLink&lt;/A&gt;&amp;nbsp;to get a link to the file to give to the user in their browser.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2016 03:08:00 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-download-a-file-and-save-to-local-PC/m-p/173011#M6629</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-06-28T03:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to download a file and save to local PC</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-download-a-file-and-save-to-local-PC/m-p/173012#M6630</link>
      <description>&lt;P&gt;In case this might be of help to others, I decided to use the sdk suggested route and save to web server using a temp file, which I create with a new stream for the getFile method. After downloading the file I then clear the file.&lt;/P&gt;
&lt;P&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 17:37:58 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-download-a-file-and-save-to-local-PC/m-p/173012#M6630</guid>
      <dc:creator>Adrian D.2</dc:creator>
      <dc:date>2016-07-01T17:37:58Z</dc:date>
    </item>
  </channel>
</rss>

