cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Uploaded ZIP file is corrupted

Uploaded ZIP file is corrupted

cj51
Helpful | Level 5
Go to solution

After uploading a compressed ZIP file cannot be opened by the 7Zip or WinZip program on my desktop PC. I can open the original file but after I upload it using the sample code below, the file is about 90KB larger and corrupted.  Does anyone know what I am doing wrong?

Thank you in advance.

cj51

---------------------SAMPLE VBA CODE-----------------------

Function ReadBinary(sFile As String) As Byte()
    Dim nFile       As Integer
    ReadBinary = ""
    nFile = FreeFile
    Open sFile For Binary Access Read As #nFile
    If LOF(nFile) > 0 Then
        ReDim ReadBinary(0 To LOF(nFile) - 1)
        Get nFile, , ReadBinary
    End If
    Close #nFile
End Function
------------------ API SYNTAX STARTS HERE ---------------
strFile = ReadBinary(FileName)
arg = "{""path"":" & DQ & "/File requests/StatusLog/" & DropBox_FileName & DQ & "," &     """mode"":""overwrite"",""autorename"": true,""mute"":true}"

req.Open "POST", "https://content.dropboxapi.com/2/files/upload", False
req.setRequestHeader "Authorization", "Bearer <yadayada"
req.setRequestHeader "Content-Type", "application/octet-stream"
req.setRequestHeader "Content-length", Len(strFile)
req.setRequestHeader "Dropbox-API-Arg", arg
req.setRequestHeader "User-Agent", "api-explorer-client"
req.send strFile

1 Accepted Solution

Accepted Solutions

cj51
Helpful | Level 5
Go to solution

PROBLEM SOLVED! -  I replaced the send strFile with send ReadBinary function, deleted the strFile = ReadBinnary line and replaced the Len(strFile) with FileLen("NAME OF INPUT FILE').  This issue can be closed.

View solution in original post

1 Reply 1

cj51
Helpful | Level 5
Go to solution

PROBLEM SOLVED! -  I replaced the send strFile with send ReadBinary function, deleted the strFile = ReadBinnary line and replaced the Len(strFile) with FileLen("NAME OF INPUT FILE').  This issue can be closed.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    cj51 Helpful | Level 5
What do Dropbox user levels mean?