cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Beginner question: Remote filename

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Sat, 15 Mar 2014 22:59:49 +0100

On Sat, Mar 15, 2014 at 07:53:13PM +0100, Petr Lázňovský wrote:
> Following command send form content and file to the cgi script. It works fine, but filename in the server is "1file" instead of "config.bin" even if I set remote name by: -F "f1=@config.bin;filename=config.bin"
>
> what am I doing wrong?
>
> thanks, L.
>
> curl -F "cmd=newticket" -F "do=1" -F "name=Joe" -F "email=Joe@Blow.com" -F "subject=this is my subject" -F "problem=text message" -F "name=f1" -F "f1=@config.bin;filename=config.bin" "http://sub.host.com/xxx.cgi"

What version of curl are you using? The latest one does the expected thing for
me, as this excerpt from --trace-ascii shows:

0269: --------------------------48daa29ab55def9f
0295: Content-Disposition: form-data; name="name"
02c2:
02c4: f1
02c8: --------------------------48daa29ab55def9f
02f4: Content-Disposition: form-data; name="f1"; filename="config.bin"
0336: Content-Type: application/octet-stream
035e:

If the server is turning this into a file called "1file", then it sounds like
it's completely up to the server and doesn't have much to do with what
metadata it gets sent.

>>> Dan
-------------------------------------------------------------------
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 2014-03-15