<?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: Upload file directly on dropbox in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-directly-on-dropbox/m-p/183138#M7580</link>
    <description>&lt;P&gt;hi , with this &amp;nbsp;javscript code :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; &amp;lt;form onSubmit="return uploadFile()"&amp;gt;&lt;BR /&gt; &amp;lt;input type="hidden" id="access-token" value="&amp;lt;?=$token ?&amp;gt;" /&amp;gt;&lt;BR /&gt; &amp;lt;input type="file" id="file-upload" /&amp;gt;&lt;BR /&gt; &amp;lt;button type="submit"&amp;gt;Submit&amp;lt;/button&amp;gt;&lt;BR /&gt; &amp;lt;/form&amp;gt;&lt;BR /&gt;&lt;BR /&gt; &amp;lt;!-- A place to show the status of the upload --&amp;gt;&lt;BR /&gt; &amp;lt;h2 id="results"&amp;gt;&amp;lt;/h2&amp;gt;&lt;BR /&gt;&lt;BR /&gt; &amp;lt;/section&amp;gt;&lt;BR /&gt;&lt;BR /&gt; &amp;lt;script&amp;gt;&lt;BR /&gt; function uploadFile() {&lt;BR /&gt; var ACCESS_TOKEN = document.getElementById('access-token').value;&lt;BR /&gt; var dbx = new Dropbox({ accessToken: ACCESS_TOKEN });&lt;BR /&gt; var fileInput = document.getElementById('file-upload');&lt;BR /&gt; var file = fileInput.files[0];&lt;BR /&gt; dbx.filesUpload({path: '/' + file.name, contents: file})&lt;BR /&gt; .then(function(response) {&lt;BR /&gt; var results = document.getElementById('results');&lt;BR /&gt; results.appendChild(document.createTextNode('File uploaded!'));&lt;BR /&gt; console.log(response);&lt;BR /&gt; })&lt;BR /&gt; .catch(function(error) {&lt;BR /&gt; console.error(error);&lt;BR /&gt; });&lt;BR /&gt; return false;&lt;BR /&gt; }&lt;BR /&gt; &amp;lt;/script&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;2 answer :&lt;/P&gt;
&lt;P&gt;1 : how i can see &amp;nbsp;the list of folder's file with php or js?&lt;/P&gt;
&lt;P&gt;2 : can i manage them with&amp;nbsp;php or js ?&lt;/P&gt;</description>
    <pubDate>Sun, 21 Aug 2016 15:36:06 GMT</pubDate>
    <dc:creator>Stefano B.3</dc:creator>
    <dc:date>2016-08-21T15:36:06Z</dc:date>
    <item>
      <title>Upload file directly on dropbox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-directly-on-dropbox/m-p/183136#M7578</link>
      <description>&lt;P&gt;HI ,sorry for english, Im learning &amp;nbsp;about upload a file on server &amp;nbsp;to dropbox .&lt;/P&gt;
&lt;P&gt;[code]&lt;/P&gt;
&lt;P&gt;&amp;lt;?php &lt;BR /&gt;require_once "dropbox-sdk/Dropbox/autoload.php";&lt;/P&gt;
&lt;P&gt;use \Dropbox as dbx;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;$accessToken='My_access_token ';&lt;BR /&gt;$dbxClient = new dbx\Client($accessToken, "MyApp/1.0");&lt;/P&gt;
&lt;P&gt;$f = fopen("prova.txt", "rb");&lt;BR /&gt;$result = $dbxClient-&amp;gt;uploadFile("/cambio_nome.txt", dbx\WriteMode::add(), $f);&lt;BR /&gt;fclose($f);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;print_r($result);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[/code]&lt;/P&gt;
&lt;P&gt;First question :&lt;/P&gt;
&lt;P&gt;The response is an array , how can i know i the response is success ?&lt;/P&gt;
&lt;P&gt;Second question :&lt;/P&gt;
&lt;P&gt;Can i upload file directly on dropbox without upload on my server ?&lt;/P&gt;
&lt;P&gt;Third question :&lt;/P&gt;
&lt;P&gt;Can i control if a folder exist in my app and create it if not exist than insert file in this folder&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:30:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-directly-on-dropbox/m-p/183136#M7578</guid>
      <dc:creator>Stefano B.3</dc:creator>
      <dc:date>2019-05-29T09:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file directly on dropbox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-directly-on-dropbox/m-p/183137#M7579</link>
      <description>&lt;P&gt;[Cross-linking for reference:&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/38935509/dropbox-upload-file" rel="nofollow noreferrer"&gt;https://stackoverflow.com/questions/38935509/dropbox-upload-file&lt;/A&gt; ]&lt;/P&gt;
&lt;P&gt;It looks like you're using the &lt;A href="https://www.dropbox.com/developers-v1/core/sdks/php" target="_blank" rel="nofollow noreferrer"&gt;PHP Core SDK&lt;/A&gt; for the &lt;A href="https://blogs.dropbox.com/developers/2016/06/api-v1-deprecated/" target="_blank" rel="nofollow noreferrer"&gt;deprecated&lt;/A&gt; API v1. We&amp;nbsp;recommend migrating to API v2 whenever possible. We don't have an official PHP SDK for API v2, but there are some third party ones listed &lt;A href="https://www.dropbox.com/developers/documentation/communitysdks" target="_blank" rel="nofollow noreferrer"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Anyway, to answer your questions:&lt;/P&gt;
&lt;P&gt;1) That &lt;A href="https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#_uploadFile" target="_blank" rel="nofollow noreferrer"&gt;uploadFile&lt;/A&gt; method will return the metadata for the uploaded file if the upload was successful, and will raise an exception if not.&lt;/P&gt;
&lt;P&gt;2) Using the PHP Core SDK, you'll need to have the data on your server in order to upload it. Assuming this is a web app though, you could upload it directly from the user's browser, but you'd have to build that integration in JavaScript. We are working on a &lt;A href="https://github.com/dropbox/dropbox-sdk-js" target="_blank" rel="nofollow noreferrer"&gt;JavaScript SDK for API v2&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Alternatively, if you have a URL for the file you want to upload from somewhere, you&amp;nbsp;can upload the file to&amp;nbsp;Dropbox using that URL without passing the data through your server. On API v1, you would use &lt;A href="https://www.dropbox.com/developers-v1/core/docs#save-url" target="_blank" rel="nofollow noreferrer"&gt;/save_url&lt;/A&gt; for that, but it's unfortunately not implemented in the PHP Core SDK. On API v2, you would use&amp;nbsp;&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-save_url" target="_blank" rel="nofollow noreferrer"&gt;/files/save_url&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;3) Yes, you can create folders using the API. E.g., in the PHP SDK, you would use the &lt;A href="https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#_createFolder" target="_blank" rel="nofollow noreferrer"&gt;createFolder&lt;/A&gt; method. You don't actually need to explicitly create parent folders when uploading files though. For example, if you upload a file to /Documents/myfile.docx, the "Documents" folder will automatically be created if it doesn't already exist.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 01:30:51 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-directly-on-dropbox/m-p/183137#M7579</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-08-16T01:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file directly on dropbox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-directly-on-dropbox/m-p/183138#M7580</link>
      <description>&lt;P&gt;hi , with this &amp;nbsp;javscript code :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; &amp;lt;form onSubmit="return uploadFile()"&amp;gt;&lt;BR /&gt; &amp;lt;input type="hidden" id="access-token" value="&amp;lt;?=$token ?&amp;gt;" /&amp;gt;&lt;BR /&gt; &amp;lt;input type="file" id="file-upload" /&amp;gt;&lt;BR /&gt; &amp;lt;button type="submit"&amp;gt;Submit&amp;lt;/button&amp;gt;&lt;BR /&gt; &amp;lt;/form&amp;gt;&lt;BR /&gt;&lt;BR /&gt; &amp;lt;!-- A place to show the status of the upload --&amp;gt;&lt;BR /&gt; &amp;lt;h2 id="results"&amp;gt;&amp;lt;/h2&amp;gt;&lt;BR /&gt;&lt;BR /&gt; &amp;lt;/section&amp;gt;&lt;BR /&gt;&lt;BR /&gt; &amp;lt;script&amp;gt;&lt;BR /&gt; function uploadFile() {&lt;BR /&gt; var ACCESS_TOKEN = document.getElementById('access-token').value;&lt;BR /&gt; var dbx = new Dropbox({ accessToken: ACCESS_TOKEN });&lt;BR /&gt; var fileInput = document.getElementById('file-upload');&lt;BR /&gt; var file = fileInput.files[0];&lt;BR /&gt; dbx.filesUpload({path: '/' + file.name, contents: file})&lt;BR /&gt; .then(function(response) {&lt;BR /&gt; var results = document.getElementById('results');&lt;BR /&gt; results.appendChild(document.createTextNode('File uploaded!'));&lt;BR /&gt; console.log(response);&lt;BR /&gt; })&lt;BR /&gt; .catch(function(error) {&lt;BR /&gt; console.error(error);&lt;BR /&gt; });&lt;BR /&gt; return false;&lt;BR /&gt; }&lt;BR /&gt; &amp;lt;/script&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;2 answer :&lt;/P&gt;
&lt;P&gt;1 : how i can see &amp;nbsp;the list of folder's file with php or js?&lt;/P&gt;
&lt;P&gt;2 : can i manage them with&amp;nbsp;php or js ?&lt;/P&gt;</description>
      <pubDate>Sun, 21 Aug 2016 15:36:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-directly-on-dropbox/m-p/183138#M7580</guid>
      <dc:creator>Stefano B.3</dc:creator>
      <dc:date>2016-08-21T15:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file directly on dropbox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-directly-on-dropbox/m-p/183139#M7581</link>
      <description>&lt;P&gt;hi , i try to learn&amp;nbsp;kunalvarma05 php-sdk , i have a question , i want create a folder (dropbox-&amp;gt;createFolder(path) ) if the folder not exist &amp;nbsp;, how i can do this ?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2016 18:05:03 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-directly-on-dropbox/m-p/183139#M7581</guid>
      <dc:creator>Stefano B.3</dc:creator>
      <dc:date>2016-08-23T18:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file directly on dropbox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-directly-on-dropbox/m-p/183140#M7582</link>
      <description>&lt;P&gt;To list a folder in the JavaScript SDK, you would use&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesListFolder" target="_blank" rel="nofollow noreferrer"&gt;filesListFolder&lt;/A&gt; and&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesListFolderContinue" target="_blank" rel="nofollow noreferrer"&gt;filesListFolderContinue&lt;/A&gt;. I'm not sure what you mean by "manage" exactly, but there are also other methods for other file operations, such as moving, copying, deleting, etc.&lt;/P&gt;
&lt;P&gt;Also, and for anyone else reading, please make sure to heed Stephen's advice in the&amp;nbsp;other thread warning about embedding access tokens in a client-side app like this:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dropboxforum.com/hc/en-us/community/posts/210656906-Access-token-js-security-" rel="nofollow noreferrer"&gt;https://www.dropboxforum.com/hc/en-us/community/posts/210656906-Access-token-js-security-&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I can't offer help for that third party PHP SDK, but it looks like it also has&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesListFolderContinue" target="_blank" rel="nofollow noreferrer"&gt;listFolder&lt;/A&gt; and&amp;nbsp;&lt;A href="https://kunalvarma05.github.io/dropbox-php-sdk/master/Kunnu/Dropbox/Dropbox.html#method_listFolder" target="_blank" rel="nofollow noreferrer"&gt;listFolderContinue&lt;/A&gt; methods, among others for other operations.&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://kunalvarma05.github.io/dropbox-php-sdk/master/Kunnu/Dropbox/Dropbox.html#method_createFolder" target="_blank" rel="nofollow noreferrer"&gt;createFolder&lt;/A&gt;&amp;nbsp;method you mentioned sounds like the right one for creating a folder. If you're having trouble with it, you may want to &lt;A href="https://github.com/kunalvarma05/dropbox-php-sdk/issues" target="_blank" rel="nofollow noreferrer"&gt;open an issue for the library&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 00:18:10 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-directly-on-dropbox/m-p/183140#M7582</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-08-26T00:18:10Z</dc:date>
    </item>
  </channel>
</rss>

