curl传输文件实例

curl -H "Authorization:Bearer 5d719398-4230-44c7-b88b-f280b6a8d070" -H "Accept: application/json" -H "Content-Type: multipart/mixed" -F "metadata=@test.json; name=story; type=application/json; charset=UTF-8 "  -X POST http://mypath/postpath -i -v


curl -H "Authorization:Bearer 5d719398-4230-44c7-b88b-f280b6a8d070" -H "Accept: application/json" -H "Content-Type: multipart/mixed" -F "name=story; metadata=@test.json; type=application/json; charset=UTF-8 "  -X POST http://mypath/postpath -i -v

only json
curl -H "Authorization:Bearer f19fd8c5-d64b-4ed5-bf09-556684fcc235" -H "Accept: application/json" -H "Content-Type: multipart/mixed" -F "story=@story_t1.json; type=application/json;charset=UTF-8 "  -X POST http://mypath/postpath -i -v
ok

curl  -H "Accept: application/json" -H "Content-Type: multipart/mixed" -F "story=@story_t1.json; type=application/json;charset=UTF-8 "  -X POST http://mypath/postpath -i -v
ok



test jpg
curl -H "Authorization:Bearer 5d719398-4230-44c7-b88b-f280b6a8d070" -H "Accept: application/json" -H "Content-Type: multipart/mixed" -F "story=@story_jpg.json; type=application/json;charset=UTF-8 " -F "files=@att1.jpg; type=image/jpg"  -X POST http://mypath/postpath -i -v
ok
test 2 jpgs
curl -H "Authorization:Bearer 5d719398-4230-44c7-b88b-f280b6a8d070" -H "Accept: application/json" -H "Content-Type: multipart/mixed" -F "story=@story_2jpg.json; type=application/json;charset=UTF-8 " -F "files=@att1.jpg; type=image/jpg" -F "files=@att2.jpg; type=image/jpg" -X POST http://mypath/postpath -i -v
ok


curl  -H "Accept: application/json" -H "Content-Type: multipart/mixed" -F "story=@story_t1.json; type=application/json;charset=UTF-8 "  -X POST http://mypath/postpath -i -v




curl  -H "Accept: application/json" -H "Content-Type: multipart/mixed" -F "story=@story_500.json; type=application/json;charset=UTF-8 "  -X POST http://mypath/postpath -i -v


curl -H "Authorization:Bearer 5d719398-4230-44c7-b88b-f280b6a8d070" -H "Accept: application/json" -H "Content-Type: multipart/mixed" -F "story=@story_jpg.json; type=application/json;charset=UTF-8 "   -X POST http://mypath/postpath -i -v




curl -H "Authorization:Bearer 5d719398-4230-44c7-b88b-f280b6a8d070" -H "Accept: application/json" -H "Content-Type: multipart/mixed" -F "story=@story_jpg2.json; type=application/json;charset=UTF-8 " -F "files=@att1.jpg; type=image/jpg"  -X POST http://mypath/postpath -i -v


curl -H 'Content-Type:text/plain' --data-binary @urls.txt "http://www.xxx.com/urls"

posted @ 2017-07-17 15:19  zhao1949  阅读(3301)  评论(0编辑  收藏  举报