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

  • 相关阅读:
    Design and Implementation of the Sun Network File System
    Flash: An Efficient and Portable Web Server
    Java集合框架练习-计算表达式的值
    后缀数组专题训练
    经典问题-生产者和消费者问题
    ubuntu14.04下配置Java环境以及安装最新版本的eclipse
    Java多线程之CountDownLatch学习
    ZooKeerper学习之Watcher
    ZooKeeper之FastLeaderElection算法详解
    python获取当天日期进行格式转换
  • 原文地址:https://www.cnblogs.com/dongruiha/p/7299210.html
Copyright © 2011-2022 走看看