linux创建表单命令,Linux 基础命令-CURL 表单上传文件

CURLjavascript

-F, --form

(HTTP) This lets curl emulate a filled-in form in which a user has pressed the submit button. This causes curl to POST data using the Content-Type multipart/form-

data according to RFC 2388. This enables uploading of binary files etc. To force the 'content' part to be a file, prefix the file name with an @ sign. To just get

the content part from a file, prefix the file name with the symbol <. the difference between and is then that makes a file get attached in post as>

file upload, while the < makes a text field and just get the contents for that text field from a file.html

Example, to send your password file to the server, where 'password' is the name of the form-field to which /etc/passwd will be the input:java

curl -F password=@/etc/passwd www.mypasswords.comweb

To read content from stdin instead of a file, use - as the filename. This goes for both @ and < constructs.api

You can also tell curl what Content-Type to use by using 'type=', in a manner similar to:curl

curl -F "web=@index.html;type=text/html" url.compost

orthis

curl -F "name=daniel;type=text/foo" url.comurl

You can also explicitly change the name field of a file upload part by setting filename=, like this:.net

curl -F "file=@localfile;filename=nameinpost" url.com

If filename/path contains ',' or ';', it must be quoted by double-quotes like:

curl -F "file=@\"localfile\";filename=\"nameinpost\"" url.com

or

curl -F 'file=@"localfile";filename="nameinpost"' url.com

Note that if a filename/path is quoted by double-quotes, any double-quote or backslash within the filename must be escaped by backslash.

See further examples and details in the MANUAL.

This option can be used multiple times.

(1)文件上传,Html 表单上传方式:

AppId:

上传文件:

上传类型:

惟一

覆盖

(2).curl --form upload=@a41.zip --form uptype=1 http://www.a.com/file

(3).curl -F "file=@a41.txt;filename=testaaabcd.txt" http://www.a.com/file

上传文件,文件名称:testaaabcd.txt

Post提交数据

curl -d "b=20&t=b7693b96e99" http://api.web.com/Api/getList

下载文件:

curl -o ss -H"Host:www.file.com" http://1.1.1.1/file/123.jpg

http://blog.csdn.net/xifeijian/article/details/9367339

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值