cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: pb with http post request (form) and attached file

From: Frédéric Plé <frederic.ple_at_gmail.com>
Date: Wed, 24 Oct 2007 15:18:25 +0200

Sorry I have not seen the detail about comma in the manual.
I implemented this workaround and it works well.
Thank you for your answer.

On 24/10/2007, Brian Dessent <brian_at_dessent.net> wrote:
>
> Frédéric Plé wrote:
>
> > Here is the command line I use :
> > curl -s -o /dev/null -b ./cookie.txt -F folderid=7 -F
> > 'userfile=@/tmp/4153/29 E-MAILING, FAX-MAILING ET MAILING.DOC' -F
> > expires=false -F sequence=1 'http://localhost/form-script.php'
> >
> > When I run the curl command with strace, I have this error :
> > open("/tmp/4153/29 E-MAILING", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No
> > such file or directory)
> >
> > As you can see, the filename is cut when encounters comma.
>
> From the manual:
>
> > -F accepts parameters like -F "name=contents". If you want the
> contents to
> > be read from a file, use <@filename> as contents. When specifying a
> file,
> > you can also specify the file content type by appending ';type=<mime
> type>'
> > to the file name. You can also post the contents of several files in
> one
> > field. For example, the field name 'coolfiles' is used to send three
> files,
> > with different content types using the following syntax:
> >
> > curl -F "coolfiles=@fil1.gif;type=image/gif,fil2.txt,fil3.html"
> \
> > http://www.post.com/postit.cgi
>
>
> Note that the comma is used to delimit multiple filenames, and so curl
> thinks that you're trying to specify a list of two filenames. I think
> you can work around this by urlencoding the comma.
>
> Brian
>
Received on 2007-10-24