<?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: Uploading files from a file server to DropBox in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304670#M241</link>
    <description>&lt;P&gt;I can change the code from third party to the official Dropbox Api.&lt;BR /&gt;What I want to do is to select the file that I want to upload and click the Save/Upload button to save it in Dropbox in a specific folder directory.&lt;/P&gt;&lt;P&gt;The upload method that I have right now is not throwing any error. It works as if it's uploading the file but it returns to the same page without any warning or flash message.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Oct 2018 19:12:14 GMT</pubDate>
    <dc:creator>jary_capstone</dc:creator>
    <dc:date>2018-10-22T19:12:14Z</dc:date>
    <item>
      <title>Uploading files from a file server to DropBox</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304578#M236</link>
      <description>&lt;P&gt;I've been adding some code to upload a file from my server to a specific folder in Dropbox but nothing successful. I'm using Yii2 advanced framework. (Php, javascript and html code in it).&lt;/P&gt;&lt;P&gt;These are the different options that I have used:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;$app=new DropboxApp($consumerKey,$consumerSecret,$accessToken);&lt;BR /&gt;$dropbox=new Dropbox($app);&lt;BR /&gt;&lt;BR /&gt;// Check if file was uploaded&lt;BR /&gt;if (isset($_FILES["file"])) {&lt;BR /&gt;// File to Upload&lt;BR /&gt;$file = $_FILES['file'];&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // File Path&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $fileName = $file['name'];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $filePath = $file['tmp_name'];&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Create Dropbox File from Path&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$dropboxFile = new DropboxFile($filePath);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // Upload the file to Dropbox&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; $uploadedFile = $dropbox-&amp;gt;upload($dropboxFile, "/" . $fileName,&amp;nbsp; &amp;nbsp; &amp;nbsp;['autorename' =&amp;gt; true]);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;// File Uploaded&lt;BR /&gt;&amp;nbsp; &amp;nbsp; echo $uploadedFile-&amp;gt;getPathDisplay();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; } catch (DropboxClientException $e) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; echo $e-&amp;gt;getMessage();&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2. This one creates the folder but does not save the file...&lt;/P&gt;&lt;P&gt;&amp;nbsp;$inputData=Yii::$app-&amp;gt;request-&amp;gt;post();&lt;BR /&gt;$dropboxFile = new DropboxFile($filePath);&lt;BR /&gt;&amp;nbsp;$folderName = $inputData['Model']['file];&lt;BR /&gt;&amp;nbsp;$file = $dropbox-&amp;gt;upload($dropboxFile, "/".$fileName, ['autorename' =&amp;gt; true]);&lt;BR /&gt;$folderName = $inputData['Model']['file'];&lt;BR /&gt;&amp;nbsp;$folder = $dropbox-&amp;gt;createFolder($dropboxFile,"/".$folderName);&lt;BR /&gt;&amp;nbsp;$path = '&lt;A href="https://www.dropbox.com/home/.../" target="_blank"&gt;https://www.dropbox.com/home/.../&lt;/A&gt;...' .$file-&amp;gt;path_display;&lt;BR /&gt;&amp;nbsp;$dropbox_path = array('dropbox_path'=&amp;gt;$path);&lt;BR /&gt;&amp;nbsp;$inputData['Model']['dropbox_path'] = $path;&lt;BR /&gt;$model-&amp;gt;load($inputData);&lt;BR /&gt;&amp;nbsp;$model-&amp;gt;save(false);&lt;BR /&gt;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;Any suggestion? Other code that I can implement to it?&lt;BR /&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:05:40 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304578#M236</guid>
      <dc:creator>jary_capstone</dc:creator>
      <dc:date>2019-05-29T09:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading files from a file server to DropBox</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304582#M237</link>
      <description>&lt;DIV&gt;&lt;SPAN class=" author-d-1gg9uz65z1iz85zgdz68zmqkz84zo2qovvz69zj2z87zz74zxz85zbz74zrz71zz90zaqz86zdz77zz83z5z87zz79zz74z67xz83zsz77zid"&gt;Hey &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/778825"&gt;@jary_capstone&lt;/a&gt;!&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN class=" author-d-1gg9uz65z1iz85zgdz68zmqkz84zo2qovvz69zj2z87zz74zxz85zbz74zrz71zz90zaqz86zdz77zz83z5z87zz79zz74z67xz83zsz77zid"&gt;I’ve gone ahead and moved your post to the developer section of the Forum - perhaps some like-minded users will have some ideas to share on this with you.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN class=" author-d-1gg9uz65z1iz85zgdz68zmqkz84zo2qovvz69zj2z87zz74zxz85zbz74zrz71zz90zaqz86zdz77zz83z5z87zz79zz74z67xz83zsz77zid"&gt;Cheers!&amp;nbsp;&lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@E2F7D53C249D2CA37FB0CD78E32CFDED/images/emoticons/1f913.png" alt=":nerd:" title=":nerd:" /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 22 Oct 2018 13:58:31 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304582#M237</guid>
      <dc:creator>Lusil</dc:creator>
      <dc:date>2018-10-22T13:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading files from a file server to DropBox</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304655#M239</link>
      <description>&lt;P&gt;From the code you provided, it looks like you're using this third party library:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/kunalvarma05/dropbox-php-sdk" target="_blank"&gt;https://github.com/kunalvarma05/dropbox-php-sdk&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;We can't provide support for third party libaries, as we didn't make them, but we'll be happy to help with any issues you're having with the&amp;nbsp;Dropbox API itself.&lt;/P&gt;
&lt;P&gt;Whenever you make a&amp;nbsp;Dropbox API call, you should&amp;nbsp;receive a response indicating if the call succeeded or failed. It sounds like you're having trouble uploading to Dropbox. What does the 'upload' method return or throw?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 18:11:18 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304655#M239</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-10-22T18:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading files from a file server to DropBox</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304670#M241</link>
      <description>&lt;P&gt;I can change the code from third party to the official Dropbox Api.&lt;BR /&gt;What I want to do is to select the file that I want to upload and click the Save/Upload button to save it in Dropbox in a specific folder directory.&lt;/P&gt;&lt;P&gt;The upload method that I have right now is not throwing any error. It works as if it's uploading the file but it returns to the same page without any warning or flash message.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 19:12:14 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304670#M241</guid>
      <dc:creator>jary_capstone</dc:creator>
      <dc:date>2018-10-22T19:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading files from a file server to DropBox</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304691#M242</link>
      <description>&lt;P&gt;If the method is not throwing an error, what is it returning? (I.e., `&lt;SPAN&gt;$uploadedFile` in your code #1, or `$file` in your code #2.)`&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Oct 2018 20:37:04 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304691#M242</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-10-22T20:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading files from a file server to DropBox</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304828#M243</link>
      <description>&lt;P&gt;$uploadedFile in code #1.&lt;/P&gt;&lt;P&gt;It seems the variable is not taking the file that I selected so the variable is coming empty.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 12:19:24 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304828#M243</guid>
      <dc:creator>jary_capstone</dc:creator>
      <dc:date>2018-10-23T12:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading files from a file server to DropBox</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304854#M244</link>
      <description>&lt;P&gt;I'm not sure I understand what you mean when you say "the variable is not taking the file that I selected".&lt;/P&gt;
&lt;P&gt;Do you mean&amp;nbsp;$uploadedFile is null after the upload method runs? It sounds like the method didn't successfully run. You may need to debug your code more, or double check if you're getting any other output or error.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 14:22:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304854#M244</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-10-23T14:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading files from a file server to DropBox</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304855#M245</link>
      <description>&lt;P&gt;You actually got to the point... the method did not succesfully run.&lt;/P&gt;&lt;P&gt;I change the code to a different one and now it's running but it's not saving in the desire folder: using DropboxUploader&lt;/P&gt;&lt;P&gt;&amp;lt;?php&lt;BR /&gt;if ($_POST) {&lt;BR /&gt;require 'DropboxUploader.php';&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;try {&lt;BR /&gt;// Rename uploaded file to reflect original name&lt;BR /&gt;if ($_FILES['file']['error'] !== UPLOAD_ERR_OK)&lt;BR /&gt;throw new Exception('File was not successfully uploaded from your computer.');&lt;/P&gt;&lt;P&gt;$tmpDir = uniqid('/tmp/DropboxUploader-');&lt;BR /&gt;if (!mkdir($tmpDir))&lt;BR /&gt;throw new Exception('Cannot create temporary directory!');&lt;/P&gt;&lt;P&gt;if ($_FILES['file']['name'] === "")&lt;BR /&gt;throw new Exception('File name not supplied by the browser.');&lt;/P&gt;&lt;P&gt;$tmpFile = $tmpDir.'/'.str_replace("/\0", '_', $_FILES['file']['name']);&lt;BR /&gt;if (!move_uploaded_file($_FILES['file']['tmp_name'], $tmpFile))&lt;BR /&gt;throw new Exception('Cannot rename uploaded file!');&lt;/P&gt;&lt;P&gt;// Enter your Dropbox account credentials here&lt;BR /&gt;$uploader = new DropboxUploader('email', 'password');&lt;BR /&gt;$uploader-&amp;gt;upload($tmpFile, $_POST['dest']);&lt;/P&gt;&lt;P&gt;echo '&amp;lt;span style="color: green;font-weight:bold;margin-left:393px;"&amp;gt;File successfully uploaded to my Dropbox!&amp;lt;/span&amp;gt;';&lt;BR /&gt;} catch(Exception $e) {&lt;BR /&gt;echo '&amp;lt;span style="color: red;font-weight:bold;margin-left:393px;"&amp;gt;Error: ' . htmlspecialchars($e-&amp;gt;getMessage()) . '&amp;lt;/span&amp;gt;';&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// Clean up&lt;BR /&gt;if (isset($tmpFile) &amp;amp;&amp;amp; file_exists($tmpFile))&lt;BR /&gt;unlink($tmpFile);&lt;/P&gt;&lt;P&gt;if (isset($tmpDir) &amp;amp;&amp;amp; file_exists($tmpDir))&lt;BR /&gt;rmdir($tmpDir);&lt;BR /&gt;}&lt;BR /&gt;?&amp;gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 14:29:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304855#M245</guid>
      <dc:creator>jary_capstone</dc:creator>
      <dc:date>2018-10-23T14:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading files from a file server to DropBox</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304876#M246</link>
      <description>&lt;P&gt;Based on this code, it looks like you've switched to using this other "Dropbox Uploader" library:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/jakajancar/DropboxUploader" target="_blank"&gt;https://github.com/jakajancar/DropboxUploader&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;We do not&amp;nbsp;recommend using this. From the its own readme:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;"Its development was started before Dropbox released their API, and to work, it scrapes their website. So you can and probably should use their API now as it is much more stable."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;recommend using &lt;A href="https://www.dropbox.com/developers/documentation/communitysdks" target="_blank"&gt;a third party library&lt;/A&gt; that actually uses the API, like you were before, or calling &lt;A href="https://www.dropbox.com/developers/documentation/http" target="_blank"&gt;the API&lt;/A&gt; directly.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 16:42:17 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304876#M246</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-10-23T16:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Uploading files from a file server to DropBox</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304885#M247</link>
      <description>&lt;P&gt;I'll try my best. If it start to give me errors or problems for upload a file then I will recurr here to the forum and ask about it.&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Oct 2018 17:07:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Uploading-files-from-a-file-server-to-DropBox/m-p/304885#M247</guid>
      <dc:creator>jary_capstone</dc:creator>
      <dc:date>2018-10-23T17:07:38Z</dc:date>
    </item>
  </channel>
</rss>

