<?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 doesn't open in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193473#M8680</link>
    <description>I can't speak to how WinMerge does encoding detection, but it does seem the files are identical, so it seems the Dropbox upload/download worked correctly. Does the original file work correctly in Excel?</description>
    <pubDate>Mon, 07 Nov 2016 21:38:40 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2016-11-07T21:38:40Z</dc:date>
    <item>
      <title>Upload file doesn't open</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193319#M8669</link>
      <description>&lt;P&gt;I am trying to upload an .xlsx file using VBA. &amp;nbsp;The upload seems to work and the file appears in dropbox, but it will not preview and once downloaded, will not open in excel. &amp;nbsp;I compared the original and the uploaded files using winmerge. &amp;nbsp;It says the files are equal, though I notice the encoding of the original is 1252 and the uploaded is UTF-8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my code. &amp;nbsp;Please let me know what is woring.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Sub DB_PutFile(FileName As String)&lt;BR /&gt;Dim req As MSXML2.ServerXMLHTTP60&lt;BR /&gt;Dim strFile As String&lt;BR /&gt;Dim Pos1 As Integer&lt;BR /&gt;Dim Pos2 As Integer&lt;BR /&gt;Set req = New MSXML2.ServerXMLHTTP60&lt;BR /&gt;Dim arg As String&lt;BR /&gt;strFile= ReadBinary(FileName)&lt;BR /&gt;arg = "{""path"":""/" &amp;amp; FileName &amp;amp; """,""mode"":{"".tag"":""overwrite""},""autorename"":false,""mute"":true}"&lt;BR /&gt;req.Open "POST", "&lt;A href="https://content.dropboxapi.com/2/files/upload" target="_blank"&gt;https://content.dropboxapi.com/2/files/upload&lt;/A&gt;", False&lt;BR /&gt;req.setRequestHeader "Authorization", "Bearer xxxxxxxxxxxxxxxx"&lt;BR /&gt;req.setRequestHeader "Content-Type", "application/octet-stream"&lt;BR /&gt;req.setRequestHeader "Content-length", Len(Result)&lt;BR /&gt;req.setRequestHeader "Dropbox-API-Arg", arg&lt;BR /&gt;req.setRequestHeader "User-Agent", "api-explorer-client"&lt;BR /&gt;req.send&amp;nbsp;strFile&lt;BR /&gt;&lt;BR /&gt;If req.Status = 200 Then&lt;BR /&gt;&lt;BR /&gt;Debug.Print req.responseText&lt;BR /&gt;&lt;BR /&gt;Else&lt;BR /&gt;'MsgBox req.Status &amp;amp; ": " &amp;amp; req.statusText&lt;BR /&gt;Debug.Print req.responseText&lt;BR /&gt;End If&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Function ReadBinary(FileName As String) As String&lt;BR /&gt;Dim f As Integer&lt;BR /&gt;f = FreeFile()&lt;BR /&gt;Open Uploadpath &amp;amp; FileName For Binary Access Read Lock Write As #f&lt;BR /&gt;ReadBinary = Space(FileLen(Uploadpath &amp;amp; FileName))&lt;BR /&gt;Get #f, , ReadBinary&lt;BR /&gt;Close #f&lt;BR /&gt;End Function&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:28:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193319#M8669</guid>
      <dc:creator>ERS R.</dc:creator>
      <dc:date>2019-05-29T09:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file doesn't open</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193450#M8678</link>
      <description>I don't see anything clearly wrong here, but can you clarify what you mean when you say that WinMerge indicates the files are equal but have different encodings? If the files have the same content, the upload must have worked correctly. You might want to try hashing the files to see if they are exactly the same. Comparing the file lengths and even just opening the files as text may be useful points of reference as well.</description>
      <pubDate>Mon, 07 Nov 2016 19:46:43 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193450#M8678</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-11-07T19:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file doesn't open</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193455#M8679</link>
      <description>&lt;P&gt;Best answer I can give is this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="http://i37.photobucket.com/albums/e77/Unforgettableknight/DBerror_zpskjpx57jc.jpg" border="0" alt="Error" width="1024" height="544" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 20:02:17 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193455#M8679</guid>
      <dc:creator>ERS R.</dc:creator>
      <dc:date>2016-11-07T20:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file doesn't open</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193473#M8680</link>
      <description>I can't speak to how WinMerge does encoding detection, but it does seem the files are identical, so it seems the Dropbox upload/download worked correctly. Does the original file work correctly in Excel?</description>
      <pubDate>Mon, 07 Nov 2016 21:38:40 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193473#M8680</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-11-07T21:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file doesn't open</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193476#M8681</link>
      <description>&lt;P&gt;Original file opens in excel. &amp;nbsp;Original file when uploaded to dropbox manually (not using API) will preview in dropbox and when downloaded, will open in excel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;API uploaded file does not preview. &amp;nbsp;Manually downloading API uploaded file will not open in excel. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 21:44:18 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193476#M8681</guid>
      <dc:creator>ERS R.</dc:creator>
      <dc:date>2016-11-07T21:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file doesn't open</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193482#M8682</link>
      <description>&lt;P&gt;Is "ReadBinary" something you&amp;nbsp;wrote yourself? I can't seem to find&amp;nbsp;a definition for it. If you could either share the code or point to the documentation, that would help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(This sort of error is typically caused by&amp;nbsp;decoding or encoding the file wrong, so I wonder if ReadBinary is doing something incorrectly.)&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 21:59:37 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193482#M8682</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2016-11-07T21:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file doesn't open</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193484#M8683</link>
      <description>&lt;P&gt;Oh, sorry, I see that you already included ReadBinary. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&amp;nbsp;Sorry!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 22:00:11 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193484#M8683</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2016-11-07T22:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file doesn't open</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193489#M8684</link>
      <description>&lt;P&gt;Try this instead? I have a suspicion that returning a String is the issue... the upload sees a string and tries to encode it as UTF-8, leading to the changes to the content making the file unusable.&amp;nbsp;I&amp;nbsp;don't think I've ever used VBA before, so this is code adapted from the web that I have&amp;nbsp;&lt;EM&gt;not&lt;/EM&gt; tested yet. Apologies if there are mistakes!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="lang-vb prettyprint prettyprinted"&gt;&lt;CODE&gt;&lt;SPAN class="kwd"&gt;Private&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;Function&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; ReadBinary&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(FileName&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;As&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;String&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;As&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;Byte&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;()&lt;/SPAN&gt;
    &lt;SPAN class="kwd"&gt;Dim&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; f &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;As&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;Integer&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;

    f &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; FreeFile
    Open FileName &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;For&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; Input Access Read &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;As&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;#f&lt;/SPAN&gt;
&lt;SPAN class="pln"&gt;    ReadBinary &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; InputB&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;LOF&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;f&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;),&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; f&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="pln"&gt;    Close &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;#f&lt;/SPAN&gt;
&lt;SPAN class="kwd"&gt;End&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;Function&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 22:19:30 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193489#M8684</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2016-11-07T22:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file doesn't open</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193500#M8687</link>
      <description>&lt;P&gt;Your function didnt work, but your idea did.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used this function and it worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="kwd"&gt;Public&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;Function&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; GetFileBytes&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;ByVal&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; path &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;As&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;String&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;As&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;Byte&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;()&lt;/SPAN&gt;
    &lt;SPAN class="kwd"&gt;Dim&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; lngFileNum &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;As&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;Long&lt;/SPAN&gt;
    &lt;SPAN class="kwd"&gt;Dim&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; bytRtnVal&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;()&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;As&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;Byte&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;    lngFileNum &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; FreeFile
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;If&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; LenB&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;Dir&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;path&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;))&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;Then&lt;/SPAN&gt; &lt;SPAN class="com"&gt;''// Does file exist?&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;        Open path &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;For&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; Binary Access Read &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;As&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; lngFileNum
        &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;ReDim&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; bytRtnVal&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;LOF&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;lngFileNum&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;-&lt;/SPAN&gt; &lt;SPAN class="lit"&gt;1&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;&amp;amp;)&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;As&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;Byte&lt;/SPAN&gt;
        &lt;SPAN class="kwd"&gt;Get&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; lngFileNum&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt; &lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; bytRtnVal
        Close lngFileNum
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;Else&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;        Err&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;Raise &lt;/SPAN&gt;&lt;SPAN class="lit"&gt;53&lt;/SPAN&gt;
    &lt;SPAN class="kwd"&gt;End&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;If&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;    GetFileBytes &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; bytRtnVal
    &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;Erase&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; bytRtnVal&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;End&lt;/SPAN&gt; &lt;SPAN class="kwd"&gt;Function&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Nov 2016 22:56:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193500#M8687</guid>
      <dc:creator>ERS R.</dc:creator>
      <dc:date>2016-11-07T22:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Upload file doesn't open</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193501#M8688</link>
      <description>&lt;P&gt;I'm glad you got it sorted out! Thanks for being patient with my lack of VBA knowledge.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2016 22:58:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-doesn-t-open/m-p/193501#M8688</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2016-11-07T22:58:55Z</dc:date>
    </item>
  </channel>
</rss>

