<?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 Corrupted Files using API in PowerShell in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Corrupted-Files-using-API-in-PowerShell/m-p/481252#M1663</link>
    <description>&lt;P&gt;Hi All.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;I'm using the below code in powershell but for some reason the files get corrupted once they arrived to dropbox folder.&amp;nbsp; If i transfer the file manually there's no issues, the error it's present only using the dropbox API, do you have and idea why this happened?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;$SourceFilePath&lt;/SPAN&gt; &lt;SPAN class="s4"&gt;=&lt;/SPAN&gt; "PathSource"&lt;/P&gt;
&lt;P class="p2"&gt;$TargetFilePath &lt;SPAN class="s4"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s5"&gt;"PathDestination&lt;/SPAN&gt;&lt;SPAN class="s5"&gt;"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;$arg&lt;/SPAN&gt; &lt;SPAN class="s4"&gt;=&lt;/SPAN&gt; '{ "path": "' &lt;SPAN class="s4"&gt;+&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;$TargetFilePath&lt;/SPAN&gt; &lt;SPAN class="s4"&gt;+&lt;/SPAN&gt; '", "mode": "add", "autorename": true, "mute": false }'&lt;/P&gt;
&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p4"&gt;#$authorization = "Bearer " + (get-item env:DropBoxAccessToken).Value&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;$authorization&lt;/SPAN&gt; &lt;SPAN class="s4"&gt;=&lt;/SPAN&gt; "Bearer " &lt;SPAN class="s4"&gt;+&lt;/SPAN&gt; 'KEY'&lt;/P&gt;
&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;$headers&lt;/SPAN&gt; &lt;SPAN class="s4"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s6"&gt;New-Object&lt;/SPAN&gt; "System.Collections.Generic.Dictionary[[String],[String]]"&lt;/P&gt;
&lt;P class="p2"&gt;$headers&lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;&lt;SPAN class="s3"&gt;Add(&lt;/SPAN&gt;&lt;SPAN class="s5"&gt;"Authorization"&lt;/SPAN&gt;&lt;SPAN class="s4"&gt;,&lt;/SPAN&gt; $authorization&lt;SPAN class="s3"&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;$headers&lt;/SPAN&gt;&lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;&lt;SPAN class="s3"&gt;Add(&lt;/SPAN&gt;"Dropbox-API-Arg"&lt;SPAN class="s4"&gt;,&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;$arg&lt;/SPAN&gt;&lt;SPAN class="s3"&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;$headers&lt;/SPAN&gt;&lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;&lt;SPAN class="s3"&gt;Add(&lt;/SPAN&gt;"Content-Type"&lt;SPAN class="s4"&gt;,&lt;/SPAN&gt; 'application/octet-stream'&lt;SPAN class="s3"&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p5"&gt;&lt;SPAN class="s6"&gt;Invoke-RestMethod&lt;/SPAN&gt; &lt;SPAN class="s7"&gt;-Uri&lt;/SPAN&gt; &lt;A href="https://content.dropboxapi.com/2/files/upload" target="_blank" rel="noopener"&gt;https://content.dropboxapi.com/2/files/upload&lt;/A&gt; &lt;SPAN class="s7"&gt;-Method&lt;/SPAN&gt; Post &lt;SPAN class="s7"&gt;-InFile&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;$SourceFilePath&lt;/SPAN&gt; &lt;SPAN class="s7"&gt;-Headers&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;$headers &lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Dec 2020 11:38:19 GMT</pubDate>
    <dc:creator>Shushu</dc:creator>
    <dc:date>2020-12-22T11:38:19Z</dc:date>
    <item>
      <title>Corrupted Files using API in PowerShell</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Corrupted-Files-using-API-in-PowerShell/m-p/481252#M1663</link>
      <description>&lt;P&gt;Hi All.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;I'm using the below code in powershell but for some reason the files get corrupted once they arrived to dropbox folder.&amp;nbsp; If i transfer the file manually there's no issues, the error it's present only using the dropbox API, do you have and idea why this happened?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;$SourceFilePath&lt;/SPAN&gt; &lt;SPAN class="s4"&gt;=&lt;/SPAN&gt; "PathSource"&lt;/P&gt;
&lt;P class="p2"&gt;$TargetFilePath &lt;SPAN class="s4"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s5"&gt;"PathDestination&lt;/SPAN&gt;&lt;SPAN class="s5"&gt;"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;$arg&lt;/SPAN&gt; &lt;SPAN class="s4"&gt;=&lt;/SPAN&gt; '{ "path": "' &lt;SPAN class="s4"&gt;+&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;$TargetFilePath&lt;/SPAN&gt; &lt;SPAN class="s4"&gt;+&lt;/SPAN&gt; '", "mode": "add", "autorename": true, "mute": false }'&lt;/P&gt;
&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p4"&gt;#$authorization = "Bearer " + (get-item env:DropBoxAccessToken).Value&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;$authorization&lt;/SPAN&gt; &lt;SPAN class="s4"&gt;=&lt;/SPAN&gt; "Bearer " &lt;SPAN class="s4"&gt;+&lt;/SPAN&gt; 'KEY'&lt;/P&gt;
&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;$headers&lt;/SPAN&gt; &lt;SPAN class="s4"&gt;=&lt;/SPAN&gt; &lt;SPAN class="s6"&gt;New-Object&lt;/SPAN&gt; "System.Collections.Generic.Dictionary[[String],[String]]"&lt;/P&gt;
&lt;P class="p2"&gt;$headers&lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;&lt;SPAN class="s3"&gt;Add(&lt;/SPAN&gt;&lt;SPAN class="s5"&gt;"Authorization"&lt;/SPAN&gt;&lt;SPAN class="s4"&gt;,&lt;/SPAN&gt; $authorization&lt;SPAN class="s3"&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;$headers&lt;/SPAN&gt;&lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;&lt;SPAN class="s3"&gt;Add(&lt;/SPAN&gt;"Dropbox-API-Arg"&lt;SPAN class="s4"&gt;,&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;$arg&lt;/SPAN&gt;&lt;SPAN class="s3"&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;$headers&lt;/SPAN&gt;&lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;&lt;SPAN class="s3"&gt;Add(&lt;/SPAN&gt;"Content-Type"&lt;SPAN class="s4"&gt;,&lt;/SPAN&gt; 'application/octet-stream'&lt;SPAN class="s3"&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p5"&gt;&lt;SPAN class="s6"&gt;Invoke-RestMethod&lt;/SPAN&gt; &lt;SPAN class="s7"&gt;-Uri&lt;/SPAN&gt; &lt;A href="https://content.dropboxapi.com/2/files/upload" target="_blank" rel="noopener"&gt;https://content.dropboxapi.com/2/files/upload&lt;/A&gt; &lt;SPAN class="s7"&gt;-Method&lt;/SPAN&gt; Post &lt;SPAN class="s7"&gt;-InFile&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;$SourceFilePath&lt;/SPAN&gt; &lt;SPAN class="s7"&gt;-Headers&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;$headers &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 11:38:19 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Corrupted-Files-using-API-in-PowerShell/m-p/481252#M1663</guid>
      <dc:creator>Shushu</dc:creator>
      <dc:date>2020-12-22T11:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Corrupted Files using API in PowerShell</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Corrupted-Files-using-API-in-PowerShell/m-p/481369#M1666</link>
      <description>&lt;P&gt;Can you elaborate on what you mean when you say the uploaded file is corrupted? For instance, is the file bigger or smaller than expected? You could also try downloading the file and opening it as text to see what the data, if any, actually is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, I just tried this myself, plugging in a test access token and my own path values, and it correctly uploaded the file for me.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 16:02:11 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Corrupted-Files-using-API-in-PowerShell/m-p/481369#M1666</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-12-22T16:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Corrupted Files using API in PowerShell</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Corrupted-Files-using-API-in-PowerShell/m-p/481431#M1670</link>
      <description>&lt;P&gt;Thanks for your reply.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I'm downloading .tiff files and the size varies 4.9MB, 9MB, 44MB, 106MB, files less than 4MB they get to the dropbox without issues, once the file is at my download folder, i'm changing the file name (&lt;SPAN&gt;Get-ChildItem&lt;/SPAN&gt; &lt;SPAN&gt;-Path&lt;/SPAN&gt; C:\User\Downloads &lt;SPAN&gt;-Filter&lt;/SPAN&gt; *.tiff &lt;SPAN&gt;|&lt;/SPAN&gt; &lt;SPAN&gt;Rename-Item&lt;/SPAN&gt; &lt;SPAN&gt;-NewName&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;SPAN&gt;$Name&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt; &lt;SPAN&gt;$_&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;extension}&lt;/SPAN&gt;) and then using the API to sent the file over.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 20:00:27 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Corrupted-Files-using-API-in-PowerShell/m-p/481431#M1670</guid>
      <dc:creator>Shushu</dc:creator>
      <dc:date>2020-12-22T20:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: Corrupted Files using API in PowerShell</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Corrupted-Files-using-API-in-PowerShell/m-p/481438#M1673</link>
      <description>&lt;P&gt;I just tried again with a .tiff file, about 10 MB, and it still worked correctly for me, so it sounds like there's something in your environment not working as expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there some sort of file size limit or timeout on your network client?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How does the size of the corrupted uploaded file compare to the original file? In what way is it corrupted exactly? Have you inspected the contents?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 20:26:04 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Corrupted-Files-using-API-in-PowerShell/m-p/481438#M1673</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-12-22T20:26:04Z</dc:date>
    </item>
  </channel>
</rss>

