Nikhil
Nikhil

Reputation: 11

how to upload a file using libcurl in c

I am building an application and I want it to upload a file using http . I am doing this using libcurl. I would like someone to give an example on how to upload a file, either in c using lib curl. Thanks in advance!

Upvotes: 0

Views: 13718

Answers (1)

Fred Foo
Fred Foo

Reputation: 363858

See the file upload example in the cURL docs and change the protocol from file to whatever you want to use: http://curl.haxx.se/libcurl/c/fileupload.html. Note that CURLOPT_UPLOAD will send a PUT request when doing HTTP.

Or check out the FTP upload example: http://curl.haxx.se/libcurl/c/ftpupload.html

Upvotes: 1

Related Questions