curl-library
Re: uploading a file via a HTML form
Date: Wed, 9 Apr 2003 20:17:26 +0200 (CEST)
On Wed, 9 Apr 2003, Giorgio Cattaneo wrote:
> where form.html has the following form:
>
> <form enctype="multipart/form-data" action="process.cgi" method="POST">
> <input type=hidden name="MAX_FILE_SIZE" value="153600">
> <input type="file" name="fupload"><br>
> <input type=submit name="submit" value=ok>
> </form>
[snip]
> Could somebody tell me if this functionality is supported in the libcurl
> library.
Yes it is, otherwise wouldn't curl be able to do it. ;-)
> If yes, does anybody have any idea of how it can be done?
I do!
curl_formadd() is the key here. You use it to add sections to a formpost,
basicly one call for each -F option in the curl command line.
Study the man page (online here:
http://curl.haxx.se/libcurl/c/curl_formadd.html) and do ask more specific
questions if it isn't enough.
I figure we should produce some example source code for this, so if you end
up with anything useful that can serve future users, then I'm interested!
-- Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs. ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.comReceived on 2003-04-09