我有一个关于cURL用法的简单问题.在我的Google搜索或手册页中找不到太多,以获得明确的答案.
在这里讨论使用--datavs --form发送文件/附件.我很想知道主要区别是什么,在什么情况下你会选择--data-binaryVS --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 "foo=@foovalue.txt"        # the specified file is sent as an attachment
-d "foo=bar"
-d "foo=<foovalue.txt"
-d "foo=@foovalue.txt"
-d "@entirebody.txt"          # the specified file is used as the POST body
--data-binary "@binarybody.jpg"
Run Code Online (Sandbox Code Playgroud)
    不同之处在表单的HTML 4.01规范部分中进行了解释:
application/x-www-form-urlencoded是默认的内容类型.
内容类型"application/x-www-form-urlencoded"对于发送大量二进制数据或包含非ASCII字符的文本效率低下.内容类型"multipart/form-data"应该用于提交包含文件,非ASCII数据和二进制数据的表单.
|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           13455 次  |  
        
|   最近记录:  |