cURL / Mailing Lists / curl-library / Single Mail

curl-library

how to do multi-part formposts

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 7 Jun 2002 11:01:12 +0200 (MET DST)

This is a good case to discuss on the list.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
---------- Forwarded message ----------
Date: Thu, 06 Jun 2002 12:26:01 -0400
From: "Combes, Chris M." <ccombes_at_northropgrumman.com>
To: Daniel Stenberg <daniel_at_haxx.se>
Subject: Help!
Daniel,
I know you're probably busy with other things but I really need help with curl.
What I need to do is to upload at least two separate files.
The examples don't state clearly how to do this.
The multipart form data, for an upload, will contain something like:
Content-Disposition: form-data; name="file"; filename=""
<data>
However, if I use CURLFORM_FILECONTENT it only loads ascii data
as a value to a parameter, and does not add the second "filename"
which contains the actual filename such as "image.png", and
then push the <data> that will be parsed on the server.
The tutorial says to use the following for binary data:
curl_formadd(&post, &last,
             CURLFORM_COPYNAME, "logotype-image",
             CURLFORM_FILECONTENT, "curl.png", CURLFORM_END);
However it appears (testing with ascii data) that the file content
is just associated with a value such as "logotyp-image=<data>",
instead of the format that an upload form uses.
Bottomline - I would like to mimic the method of using a
web-page form for uploading at least two files. I tested
the parsing of the upload data from a form, and storing
the uploaded image, and it works fine. I am using libapreq
to handle the data parsing on the server end.
Any help appreciated!
Chris
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
Received on 2002-06-07