cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How to add filename field in multipart/form-data POST

From: Yu Gong <vgong_at_adobe.com>
Date: Thu, 29 Nov 2012 00:13:14 -0800

Hi Daniel,

Here is my command:

curl -vs -H "x-adobe-gtp-api-version: 1.5" -F "from=en_US" -F "to=fr_FR"
-F "fileType=xliff" -F "cid=None" -F "pid=None" -F "cflag=False" -F
"file=;type=application/x-xliff+xml" --trace-ascii "trace.txt" "<my url>"

Below is the content of my trace:

0094: User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.1
00d4: 9.7 OpenSSL/0.9.8r zlib/1.2.3
00f3: Host: <my url>
011a: Accept: */*
0127: x-adobe-gtp-api-version: 1.5
0145: Content-Length: 765
015a: Expect: 100-continue
0170: Content-Type: multipart/form-data; boundary=--------------------
01b0: --------639de95faa5b
01c6:
<= Recv header, 23 bytes (0x17)
0000: HTTP/1.1 100 Continue
=> Send data, 765 bytes (0x2fd)
0000: ------------------------------639de95faa5b
002c: Content-Disposition: form-data; name="from"
0059:
005b: en_US
0062: ------------------------------639de95faa5b
008e: Content-Disposition: form-data; name="to"
00b9:
00bb: fr_FR
00c2: ------------------------------639de95faa5b
00ee: Content-Disposition: form-data; name="fileType"
011f:
0121: xliff
0128: ------------------------------639de95faa5b
0154: Content-Disposition: form-data; name="cid"
0180:
0182: None
0188: ------------------------------639de95faa5b
01b4: Content-Disposition: form-data; name="pid"
01e0:
01e2: None
01e8: ------------------------------639de95faa5b
0214: Content-Disposition: form-data; name="cflag"
0242:
0244: False
024b: ------------------------------639de95faa5b
0277: Content-Disposition: form-data; name="file"
02a4: Content-Type: application/x-xliff+xml
02cb:
02cd:
02cf: ------------------------------639de95faa5b--

Thanks & Regards,
Yu

On 11/29/12 4:07 PM, "Daniel Stenberg" <daniel_at_haxx.se> wrote:

>On Wed, 28 Nov 2012, Yu Gong wrote:
>
>> I tried to POST data using the content-type multipart/form-data to a
>>Web
>> server while failed because of the lack of field "filename=xxx", which
>>is
>> required by the server. Could you please let me know how I can add it
>>to my
>> POST data? I didn't find the related information in cURL manual.
>
>The "normal" -F upload=@foo style adds that by itself. Can you show us
>the
>command line you used?
>
>--
>
> / daniel.haxx.se
>-------------------------------------------------------------------
>List admin: http://cool.haxx.se/list/listinfo/curl-users
>FAQ: http://curl.haxx.se/docs/faq.html
>Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-11-29