我有一個關於cURL用法的簡單問題。在我的Google搜索或手冊頁中找不到太多內容以獲得明確答案。cURL POST --data-binary vs --form
在here談論使用--data
與--form
發送文件/附件。我很想知道主要區別是什麼,在什麼情況下你會選擇--data-binary
VS --form
?
的POST「主體」可以通過任一--data (for application/x-www-form-urlencoded)
或--form (for multipart/form-data)
被髮送:
-F "foo=bar" # 'foo' value is 'bar'
-F "foo=<foovalue.txt" # the specified file is sent as plain text input
-F "[email protected]" # the specified file is sent as an attachment
-d "foo=bar"
-d "foo=<foovalue.txt"
-d "[email protected]"
-d "@entirebody.txt" # the specified file is used as the POST body
--data-binary "@binarybody.jpg"
謝謝! 你將使用哪種類型的數據? 所以'form-urlencoded'用於將數據嵌入到請求中,但multipart是不同的? – xbeta