[RESOLVED] [VB6] upload file to Dropbox-VBForums
Results 1 to 11 of 11

Thread: [RESOLVED] [VB6] upload file to Dropbox

  1. #1

    Thread Starter
    Member
    Join Date
    May 2012
    Location
    La Plata, Buenos Aires, Argentina
    Posts
    52

    Resolved [RESOLVED] [VB6] upload file to Dropbox

    Hi.

    How can I upload a file to my Dropbox public folder (https)?

    I can download perfectly with Inet and this function:
    Code:
    Public Sub DownloadFile(strURL As String, strDestination As String)
        Const CHUNK_SIZE As Long = 1024
        Dim intFile As Integer
        Dim lngBytesReceived As Long
        Dim lngFileLength As Long
        Dim strHeader As String
        Dim b() As Byte
        
        DoEvents
        
        With Inet2
        
        .URL = strURL
        .Execute , "GET", , "Range: bytes=" & CStr(lngBytesReceived) & "-" & vbCrLf
        
        While .StillExecuting
        DoEvents
        Wend
        
        strHeader = .GetHeader
        End With
        
        strHeader = Inet2.GetHeader("Content-Length")
        lngFileLength = Val(strHeader)
        
        DoEvents
        
        lngBytesReceived = 0
        
        intFile = FreeFile()
        
        Open strDestination For Binary Access Write As #intFile
        
        Do
        b = Inet2.GetChunk(CHUNK_SIZE, icByteArray)
        Put #intFile, , b
        lngBytesReceived = lngBytesReceived + UBound(b, 1) + 1
        
        Loop While UBound(b, 1) > 0
        
        Close #intFile
    
    End Sub
    But now I need to UPload.

  2. #2

    Thread Starter
    Member
    Join Date
    May 2012
    Location
    La Plata, Buenos Aires, Argentina
    Posts
    52

    Re: [VB6] upload file to Dropbox

    I mean, it's very easy to GET from ftp and http.
    I also can PUT to ftp very easy... It should be easy as well to PUT to http!

    PS: I don't need to use Inet, I can use any way to upload to https

  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,138

    Re: [VB6] upload file to Dropbox

    In order to upload there has to be something on the other end that will receive it and the method you use needs to be in accordance with what is expected by the server.

    You say you can put very easy, why is it that you are not going that route?

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    17,486

    Re: [VB6] upload file to Dropbox

    The guts of what is required is documented at:

    https://www.dropbox.com/developers/core/docs

    There's a lot to deal with such as just for starters OAuth and JSON.

  5. #5
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    17,479

    Re: [VB6] upload file to Dropbox

    Quote Originally Posted by dilettante View Post
    The guts of what is required is documented at:

    https://www.dropbox.com/developers/core/docs

    There's a lot to deal with such as just for starters OAuth and JSON.
    At least that is well documented!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    17,486

    Re: [VB6] upload file to Dropbox

    Dropbox isn't meant to be used silently as a datastore behind an application, as made clear by requirements such as:
    Step 2 of authentication. Applications should direct the user to /oauth/authorize. This isn't an API call per se, but rather a web endpoint that lets the user sign in to Dropbox and choose whether to grant the application the ability to access files on their behalf. The page served by /oauth/authorize should be presented to the user through their web browser. Without the user's authorization in this step, it isn't possible for your application to obtain an access token from /oauth/access_token.

  7. #7

    Thread Starter
    Member
    Join Date
    May 2012
    Location
    La Plata, Buenos Aires, Argentina
    Posts
    52

    Re: [RESOLVED] [VB6] upload file to Dropbox

    Now I get why I was having so much trouble.
    For a moment I thought it was brilliant to replace my ftp server with Dropbox... now I see it was a poor illusion. I'm going back to ftp server.

    Thank you!
    Matter closed.
    (Not entierly "resolved" but closed.)

  8. #8
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    17,479

    Re: [RESOLVED] [VB6] upload file to Dropbox

    The drop box folder maps locally to your USER folder - why were you doing all this when it's just a path on your machine anyway?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  9. #9

    Thread Starter
    Member
    Join Date
    May 2012
    Location
    La Plata, Buenos Aires, Argentina
    Posts
    52

    Re: [RESOLVED] [VB6] upload file to Dropbox

    Quote Originally Posted by szlamany View Post
    The drop box folder maps locally to your USER folder - why were you doing all this when it's just a path on your machine anyway?
    Because I wanted my software, which is in many other PC, to add a file to my Dropbox account instead of uploading it to a server.

  10. #10
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    CT
    Posts
    17,479

    Re: [RESOLVED] [VB6] upload file to Dropbox

    Then why not make a "service" that is mapped to drop box - locally to itself - that sees your other PC's and does that upload??

    Are you just looking free space - or a way to archive/backup information?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  11. #11
    PowerPoster
    Join Date
    Feb 2006
    Posts
    17,486

    Re: [RESOLVED] [VB6] upload file to Dropbox

    Might be anything: user feedback, errors, usage logs, or ... keylogger captures.

    The downsides of FTP are that people can grab your credentials easily using sniffers, firewalls often block it, and NAT issues can mean you have to support PASV mode FTP.

    The downside of simple HTTP file transfer protocols is that even using SSL it is fairly easy for somebody to grab your credentials using a common tool like Fiddler.

    This is why most advanced services put you through wringers like OAuth or more complex cryptographic credential approaches using HMAC. Even OAuth is weaker than you really want to use though.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.