Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using libcurl to upload files to DropBox

Tags:

c++

c

curl

dropbox

I'm trying to use the libcurl in a C/C++ application to post files to DropBox.

I would like to use the "/files (POST)" API as documented here...

https://www.dropbox.com/developers/reference/api#files-POST

I am having problems with properly authenticating (OAuth) this call. It is unclear to me how to properly create the authentication signature.

From some a sample I saw, it looked like they were reading in the whole file to create the HMAC-SHA1 encoding on. This seems problematic on large files.

Does anyone have experience or insight using this API or something similar?

like image 857
Bob Brown Avatar asked Dec 04 '11 05:12

Bob Brown


People also ask

How do I automatically upload files to Dropbox?

In the Preferences window, open the Import tab, and you'll find settings for camera uploads and screenshots. Check Enable camera uploads, and Dropbox will automatically grab files from any camera you connect to your computer. You can optionally also enable videos.

Can curl upload files?

Uploading files using CURL is pretty straightforward once you've installed it. Several protocols allow CURL file upload including: FILE, FTP, FTPS, HTTP, HTTPS, IMAP, IMAPS, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, and TFTP. Each of these protocols works with CURL differently for uploading data.

How do I use curl to transfer files?

How to send a file using Curl? To upload a file, use the -d command-line option and begin data with the @ symbol. If you start the data with @, the rest should be the file's name from which Curl will read the data and send it to the server. Curl will use the file extension to send the correct MIME data type.


1 Answers

I have just use the libouth and libcurl to get information from sina weibo. here is my example for you refer. you can also refer the liboauth test programmer in the tests dir, oauthtest.c

    if (use_post)
    {
        req_url = oauth_sign_url2(test_call_uri, &postarg, OA_HMAC, NULL, c_key, c_secret, t_key, t_secret);
        reply = oauth_http_post(req_url,postarg);
    } 
like image 116
CodyZhang Avatar answered Oct 21 '22 13:10

CodyZhang