cURL / Mailing Lists / curl-library / Single Mail

curl-library

Multipart form upload question

From: Adam Taylor <ataylor_at_krengeltech.com>
Date: Sat, 28 Jul 2012 20:15:16 -0500

Hi, first time poster to this list. My company's utilizing libcurl to
do some communication with web services. Specifically, we're trying to
use the OS400 package. I realize that with the platform as relatively
unknown as it is, I'm probably not going to find much specific help,
but that's sort of part and parcel of being a primary RPGLE developer
:)

I'm trying to solve it using C right now, though I'll have to
translate this into how it'd work using the OS400/RPGLE binding, so
that's a whole separate headache!

Here's basically the request I'm trying to make to a remote server
using libcurl:

http://pastebin.com/MeJg4mxf

The problem is, looking at curl_formadd is giving me a pretty major
headache trying to figure out which of the options I need to be
specifying to emulate this request and have it successfully try to
upload the file. My stab at it looks like this, cobbled together from
the examples on the curl_formadd() API docs:

http://pastebin.com/ctWRCaxJ

I have no clue if this is even close to right. Areas I don't know have
any clue how to implement are the http boundary (I think that's what
the 7D_ABC_L_LMO_wB7 is called), the Content-disposition (or is that
handled by libcurl?), and the Content-transfer-encoding part.

I guess my other question is - Is there any reason I can't just build
this as a large string and send it as an HTTP post request as the
body? I'm pretty new to the form stuff, so if this is a dumb question,
please explain!
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-07-29