参考:https://curl.haxx.se/mail/archive-2003-07/0049.html
To upload a file you have to use multipart/form-data encoding.
With -d your data is sent application/x-www-form-urlencoded,
with -F as required as multipart/form-data.
[popexizhi: 参数对请求头的控制 ]
Thus, your command line should be
curl -F "photo=@1.gif;type=image/gif" -F adv_id= -F MAX_FILE_SIZE=1000000 ...
Alternatively you can try whether your server does understand a mix of GET and
POST parameters:
POST parameters:
curl -F "photo=@1.gif;type=image/gif" "http://...?adv_id=&MAX_FILE_SIZE=10..."
原始问题描述:
On Tuesday 08 July 2003 13:04, Brano wrote:
> Hi curl-users_at_lists.sourceforge.net,
>
> I want fill in form, and also upload picture at the same time, but I
> dont know how to do it:
>
> curl -F "photo=@1.gif;type=image/gif" -d
> "adv_id=&MAX_FILE_SIZE=1000000&firm=VSetko&email=vsetko_at_hotmail.com&subsect
>ion=59&location=1&want_to=100&validity=1&text=text inzeratu" "http://..."
>
> doesn't work (You can only select one HTTP request!)
>
> exist some better way to do that, or I have to:
>
> curl -F "photo=@1.gif;type=image/gif" -F "adv_id=" -F
> "MAX_FILE_SIZE=1000000" ... ?
> Hi curl-users_at_lists.sourceforge.net,
>
> I want fill in form, and also upload picture at the same time, but I
> dont know how to do it:
>
> curl -F "photo=@1.gif;type=image/gif" -d
> "adv_id=&MAX_FILE_SIZE=1000000&firm=VSetko&email=vsetko_at_hotmail.com&subsect
>ion=59&location=1&want_to=100&validity=1&text=text inzeratu" "http://..."
>
> doesn't work (You can only select one HTTP request!)
>
> exist some better way to do that, or I have to:
>
> curl -F "photo=@1.gif;type=image/gif" -F "adv_id=" -F
> "MAX_FILE_SIZE=1000000" ... ?
没有评论:
发表评论