zoukankan      html  css  js  c++  java
  • 关于Content-Type中application/x-www-form-urlencoded 和 multipart/form-data的区别及用法

    http://blog.csdn.net/soonfly/article/details/52082547

    Form的enctype属性表示页面表单数据向服务器传输时的编码方式,

    常用有两种:application/x-www-form-urlencoded 和 multipart/form-data,默认为application/x-www-form-urlencoded。


    1、application/x-www-form-urlencoded:post和get都可以用这种编码方法 
    窗体数据被编码为名称/值对,这是标准且默认的编码格式。当action为get时候,客户端把form数据转换成一个字串append到url后面,用?分割。当action为post时候,浏览器把form数据封装到http body中,然后发送到server。
    application/x-www-form-urlencoded 传递时的数据构造:
    ......
    username=twm&email=good@qq.com
    ......

    2、multipart/form-data:post方法
    multipart表示的意思是单个消息头包含多个消息体的解决方案。multipart媒体类型对发送非文本的各媒体类型是有用的。一般多用于文件上传。

    multipart/form-data只是multipart的一种。目前常用的有以下这些类型(注:任何一种执行时无法识别的multipart子类型都被视为子类型"mixed")

    HTML FORM data (see Ch. 9 and App. B) multipart/form-data
    Messages with multiple parts multipart/mixed
    Messages with multiple, alternative parts multipart/alternative
    Message with multiple, related parts multipart/related
    Multiple parts are digests multipart/digest
    For reporting of email status (admin.) multipart/report
    Order of parts does not matter multipart/parallel
    Macintosh file data multipart/appledouble
    Aggregate messages; descriptor as header multipart/header-set
    Container for voice-mail multipart/voice-message
    Infinite multiparts - See Chapter 9 (Netscape) multipart/x-mixed-replace

  • 相关阅读:
    2013-11-23 sentence patterns
    面试题 盛水 twitter
    Uva 10025 The ? 1 ? 2 ? ... ? n = k problem
    FTP服务(5)客户连接常见故障现象
    FTP服务(4)基于MySQL数据库认证
    FTP服务(3)实现基于文件验证的vsftpd虚拟用户
    FTP服务(2)实现基于SSL的FTPS
    FTP服务(1)
    Apache httpd服务
    Apache httpd服务——常用配置
  • 原文地址:https://www.cnblogs.com/dongruiha/p/7299210.html
Copyright © 2011-2022 走看看