解决ueditor中文命名图片上传错误

更改ueditor提供的uploader.java中的编码格式

public void upload() throws Exception {
      boolean isMultipart = ServletFileUpload.isMultipartContent(this.request);
      if (!isMultipart) {
            this.state = this.errorInfo.get("NOFILE");
            return;
      }
      DiskFileItemFactory dff = new DiskFileItemFactory();
      String savePath = this.getFolder(this.savePath);
      dff.setRepository(new File(savePath));
      try {
            ServletFileUpload sfu = new ServletFileUpload(dff);
           sfu.setSizeMax(this.maxSize * 1024);
           sfu.setHeaderEncoding("UTF-8");
           FileItemIterator fii = sfu.getItemIterator(this.request);
           while (fii.hasNext()) {
               FileItemStream fis = fii.next();
               if (!fis.isFormField()) {
                    this.originalName = fis.getName().substring(fis.getName().lastIndexOf(System.getProperty("file.separator")) + 1);
                        if (!this.checkFileType(this.originalName)) {
                            this.state = this.errorInfo.get("TYPE");
                             continue;
                         }

你可能感兴趣的:(解决ueditor中文命名图片上传错误)