`
fydddasas
  • 浏览: 40060 次
  • 性别: Icon_minigender_1
  • 来自: 海南
社区版块
存档分类
最新评论

request doesn't contain a multipart/form-data or multipart/mixed stream

阅读更多
form的enctype属性为编码方式,常用有两种:application/x-www-form-urlencoded和multipart/form-data,默认为application/x-www-form-urlencoded。

当action为get时候,浏览器用x-www-form-urlencoded的编码方式把form数据转换成一个字串(name1=value1&name2=value2...),然后把这个字串append到url后面,用?分割,加载这个新的url。
当action为post时候,浏览器把form数据封装到http body中,然后发送到server。

如果没有type=file的控件,用默认的application/x-www-form-urlencoded就可以了。
但是如果有type=file的话,就要用到multipart/form-data了。浏览器会把整个表单以控件为单位分割,并为每个部分加上Content-Disposition(form-data或者file),Content-Type(默认为text/plain),name(控件name)等信息,并加上分割符(boundary)。
如果有以下form,并选择了file1.txt上传
<form action="http://server.com/cgi/handle" 
       enctype="multipart/form-data" 
       method="post"> 
   <input type="text" name="submit-name" value="chmod777"><br /> 
   What files are you sending? <input type="file" name="files"><br /> 
</form>

则有如下body:
Content-Type: multipart/form-data; boundary=AaB03x

   --AaB03x
   Content-Disposition: form-data; name="submit-name"

   chmod777
   --AaB03x
   Content-Disposition: form-data; name="files"; filename="file1.txt"
   Content-Type: text/plain

   ... contents of file1.txt ...
   --AaB03x--


分享到:
评论

相关推荐

    multipartform-data 参数传递

    ### multipart/form-data 参数传递 在Web开发中,`multipart/form-data`是一种用于发送表单数据的编码类型,尤其适用于处理文件上传。此编码方式能够使客户端浏览器将表单中的普通文本字段与文件字段一起发送到...

    重新编译好的contain-executor文件,指向/etc/hadoop/container-executor.cfg

    hadoop版本3.2.1 hadoop自带的Container-executor在配置yarn-kerberos时存在问题,以及在配置cgroup时需要把container-executor.cfg的上级目录拥有者均改为root,带来不便。 所以需要重新编译Container-executor,...

    一个跨平台的CString源码

    // the string did NOT contain any of the given characters // // 2002-OCT-21 - Many thanks to Paul DeMarco who was invaluable in helping me // get this code working with Borland's free compiler as well...

    java实现文件上传

    response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Request does not contain multipart content."); } } } ``` 3. **前端页面**:创建一个HTML表单,使用`enctype="multipart/form-data"`指定表单类型...

    objenesis-1.2.jar

    hiveserver2windos环境下所需要的依赖 放到hive对应的lib下 然后... &lt;description&gt;The location of the plugin jars that contain implementations of user defined functions and serdes.&lt;/description&gt; &lt;/property&gt;

    reflectasm-1.07-shaded.jar

    使用beeline登录到hive服务端的时候报错了,错误信息如下: ... &lt;description&gt;The location of the plugin jars that contain implementations of user defined functions and serdes.&lt;/description&gt; &lt;/property&gt;

    pdfbox jar包

    PDFBox 2.0.2支持创建符合PDF/A-1b、PDF/A-2b和PDF/A-3b标准的文件。 2. **文本和图像提取**:用户可以通过PDFBox库轻松提取PDF文档中的文本和图像,这对于数据挖掘、文档转换或内容分析等任务非常有用。 3. **...

    onesignal-php-api:适用于PHP的OneSignal API

    适用于PHP的OneSignal API 安装 注意:所有示例均适用于v2,如果您使用的是PHP &lt;7.3,请阅读。 ... 您可以从和选择任何一个 ... 现在配置OneSignal api客户端: ...use Symfony \ Component \ HttpClient \ Psr18

    MinGW-64 的 DirectX Headers 副本 .zip

    MinGW-64 的 DirectX Headers 副本。...但这并不意味着您的项目在... Using theseheaders doesn't make LGPLv2.1 apply to your code, because theseheaders files contain only data structure definitions, shortmacros

    apache-maven-3.5.4

    出现报错 ...Possible solutions: - Check that Maven settings.xml does not contain...- Downgrade Maven to version 3.8.1 or earlier in settings ---------------------------------------------------------对号入座

    cocoscreater推箱子.rar

    1. 路径规划:对于复杂的关卡,可以引入A*寻路算法,帮助玩家找到最优解。 2. 动画效果:添加箱子移动和玩家行动的动画,提升游戏体验。 3. 声音效果:通过CocosCreator的音频管理模块,加入声音效果,如移动声、...

    google api php client

    The `authorize` method returns an authorized [Guzzle Client](http://docs.guzzlephp.org/), so any request made using the client will contain the corresponding authorization. ```php // create the ...

    glew-2.1.0.tgz

    Snapshots may contain new features, bug-fixes or new OpenGL extensions ahead of tested, official releases. ## Build It is highly recommended to build from a tgz or zip release snapshot. The code ...

    C8051f35x系列单片机示例程序

    // to-Noise ratio of about 117dB, or about 20 bits of effective dynamic // range. // // 117dB = 20 log10 ( 11 / 2^23) // 20 bits = 117dB / 6dB/bit // // Another parameter of note for integrating ...

    fiddler-mac.zip

    various file exports or Fiddler Script won’t handle such paths.) 4. Open Terminal and navigate to the folder from 3. 5. Type mono Fiddler.exe in Terminal. To further understand the benefits and ...

    php.ini-development

    E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a ; previously set variable or directive (e.g. ${foo}) ; Expressions in the INI file are limited to bitwise operators and parentheses: ...

    Big Data Analytics with Java

    The first part is an introduction that will help the readers get acquainted with big data environments, whereas the second part will contain a hardcore discussion on all the concepts in analytics on ...

    protobuf-dt com.google.eclipse.protobuf_2.3.2.201609161849.jar

    The descriptor.proto file deployed with 2.3.2.201609161849 seems to contain either an old or a custom version of the file - e.g. it does not contain an entry for 'csharp_namespace' and lots of others....

    82598-10-gbe-controller-datasheet

    contain a serializer-deserializer (designated “BX”) to support 1000Base-SX/LX (optical fiber) and GbE backplane applications. CX4 and XAUI interfaces are also supported. In addition to managing MAC ...

    elementUI框架构建过程

    - 如何在Vue中引入jQuery:https://segmentfault.com/a/1190000007020623 这个过程涵盖了从项目初始化到构建基本UI结构的各个环节,同时提供了进一步学习Vue.js、Webpack、ElementUI等相关技术的资源。通过实践和...

Global site tag (gtag.js) - Google Analytics