今天做图片上传的碰到这个问题,查找原因是html请求的方式问题。from中涉及到图片上传的就要用post提交方式。否则就会报这个错误。如果已经是post的提交方式了还有这个错。。。还有两种解决方法。

第一中:在jsp页面的<head></head>标签里面加上<meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />

原因请看http://www.tuicool.com/articles/FrY7Fv

第二种:在from表单的属性设置里面加上enctype="multipart/form-data"

原因请看http://zkliqiang.iteye.com/blog/779285

我的不是不是上面的任何一种,原因是前台页面的工作人员在设计页面的时候使用了百度的ueditor插件,一个功能全面的文本编辑框的插件。虽然很好用,但是他在ueditor.all.js和ueditor.all.min.js里面把post请求的Content-Type:multipart/form-data二进制传送方式变成了Content-Type:text/html。

这个原因让我花费了3个多小时。。。。。。。艹!解决方法很简单,把他们替换下就行了。

在这里结合网上查询到的坐下总结,算是做个纪念吧。

1.用ajax提交的时候如果没有在页面设置<meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />这个也会报这个错误。

2.用from提交的话,只要没有类似于ueditor这样修改提交的数据传送格式的插件。并且把提交方式设置成了post,一般就不会再出现这个错了。

3.如果上面的情况都排除了,那么查看你的插件吧!

原文地址

org.springframework.web.multipart.MultipartException: The current request is not a multipart request的更多相关文章

  1. 16-图片上传那些事 org.springframework.web.multipart.MultipartException: The current request is not a multipart request

    https://blog.csdn.net/u010974598/article/details/46458039 我曾尝试了: @RequestMapping(value="/user/r ...

  2. jquery-ajax实现文件上传异常处理web.multipart.MultipartException

    异常如下: org.springframework.web.multipart.MultipartException: The current request is not a multipart r ...

  3. 解决springMVC文件上传报错: The current request is not a multipart request

    转自:https://blog.csdn.net/HaHa_Sir/article/details/79131607 解决springMVC文件上传报错: The current request is ...

  4. org.springframework.web.servlet.DispatcherServlet noHandlerFound

    1 请求URL: http://localhost:8080/mvc/rojas 2 control  RequestMapping  : @RequestMapping(value="xx ...

  5. org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.1428942566812653608

    一.异常信息 org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet reque ...

  6. SpringMVC文件上传报错org.apache.catalina.connector.RequestFacade cannot be cast to org.springframework.web.multipart.MultipartHttpServletRequest

    错误信息: java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade cannot be cast to or ...

  7. 异常-----springmvc + ajaxfileupload解决ajax不能异步上传图片的问题。java.lang.ClassCastException: org.apache.catalina.connector.RequestFacade cannot be cast to org.springframework.web.multipart.

    说明这个问题产生的原因主要是form表单上传图片的时候必须是Content-Type:"multipart/form-data,这种格式的,但是ajax在页面不刷新的情况下去加载的时候只会把 ...

  8. SpringMVC文件上传——bean的配置【org.springframework.web.multipart.commons.CommonsMultipartResolver】

    一.简介 Spring MVC支持一个通用的多路上传解析器CommonsMultipartResolver,在Spring的配置文件中对CommonsMultipartResolver Bean进行配 ...

  9. Spring使用mutipartFile上传文件报错【Failed to instantiate [org.springframework.web.multipart.MultipartFile]】

    报错场景: 使用SSM框架实现文件上传时报“Failed to instantiate [org.springframework.web.multipart.MultipartFile]”错,控制器源 ...

随机推荐

  1. MongoDB C#驱动使用方法

    string connStr = ConfigurationManager.ConnectionStrings["MongoDBConnStr"].ConnectionString ...

  2. 洛谷P1044栈(DP)

    题目背景 栈是计算机中经典的数据结构,简单的说,栈就是限制在一端进行插入删除操作的线性表. 栈有两种最重要的操作,即poppoppop(从栈顶弹出一个元素)和pushpushpush(将一个元素进栈) ...

  3. Eclipse使用段注释格式化代码后混乱情况解决

    今天在Eclipse写代码用到段注释代码块注释一个方法,习惯使用格式化代码,结果一看格式化后的代码就乱了.就像下面那样. 觉得太乱了,而且不好对比检查.如果取消注释中间的**还保存了的,好纠结.于是就 ...

  4. A. DZY Loves Chessboard

    DZY loves chessboard, and he enjoys playing with it. He has a chessboard of n rows and m columns. So ...

  5. (爬虫)随机生成一个header

    #!/usr/bin/env python #-*- coding: utf-8 -*- #__Author__: yunrui #__Version__: 1.0 #__Time__: 2019/1 ...

  6. 7、Java类型转换

    类型转换 自动类型转换 自动类型转换指的是容量小的数据类型可以自动转换为空量大的数据类型.(容量大小不是看字节数来定的,是按照类型可以容纳多的数来定的,所以long,可以自动转为float) //特例 ...

  7. Java开发中使用模拟接口moco响应中文时乱码

    场景 在开发中需要依赖一些接口,比如需要请求一个返回Json数据的接口,但是返回Json数据的接口要么是没搭建,要么是交互比较复杂. 此时,就可以使用moco来模拟接口返回接口数据,以便开发和测试工作 ...

  8. family_to_level函数

    #include <netinet/in.h> #include <sys/socket.h> int family_to_level(int family) { switch ...

  9. 四级技能修炼NPC脚本参考

    [@main] #act CloseBigDialogBox #say \ \ <本服推出部分四级技能.升级四级技能很简单./SCOLOR=250>\ \ <只需要1个/SCOLOR ...

  10. Centos7下载和安装教程

    https://blog.csdn.net/qq_42570879/article/details/82853708 阿里下载64bit镜像:http://mirrors.aliyun.com/cen ...