How Can I Post Files and JSON Data Together With Curl?

前端 未结 4 1181
别那么骄傲
别那么骄傲 2021-02-19 03:30

I\'ve been posting a file with this curl command:

curl -i -F file=@./File.xlsm -F name=file -X POST http://example.com/new_file/

Now I want to

4条回答
  •  南方客
    南方客 (楼主)
    2021-02-19 03:54

    This worked for me:

    curl -v -H "Content-Type:multipart/form-data" -F "meta-data=@C:\Users\saurabh.sharma\Desktop\test.json;type=application/json" -F "file-data=@C:\Users\saurabh.sharma\Pictures\Saved Pictures\windows_70-wallpaper.jpg" http://localhost:7002/test/upload

    test.json has the json data I want to send.

提交回复
热议问题