The previous article has mentioned the benefits of Ueditor Baidu's rich text plug-in, which is not too long-winded here, mainly to say that Ueditor is aimed at Ueditor single picture, multi-picture, video upload and their corresponding online in Java development Summary of management issues and codes.
Ueditor uploads single file, multi-picture, video, and file in the form of file attachments of type String. Three points can be briefly summarized: the
first step: first look at the settings for the uploaded image configuration item in config.json, view imageActionName, imageFileName, imagePathFormat; the
second step: whether to upload pictures and videos, all are uploaded in the form of file attachments
Yes , so check the attachment configuration items and attachment paths, etc .; Step 3: View the source image.js and look at the return type of ajax, add what you need; Prerequisite: result.put ("state", "SUCCESS" );
Next step by step analysis!
Original link: https://blog.csdn.net/qq_43419105/java/article/details/90755402
Source config.json configuration items
/ * Upload image configuration item * / / * Upload file configuration * / /* 列出指定目录下的图片 在线管理预览 */ /* 列出指定目录下的文件 在线管理预览*/ |
Source controller.jsp configuration items
<% request.setCharacterEncoding( "utf-8" ); %> |
Service layer code:
public String uploadImage(MultipartFile file, String originalFilename, String type, Member member) throws Exception { |
Ueditor integrates Spring Boot's UeditorController class
package cn.gson.crm.controller; import java.io.File; import javax.servlet.http.HttpServletRequest; import org.apache.commons.io.IOUtils; import cn.gson.crm.common.Base64Utils; /** @Controller @RequestMapping("/config") }
|
Description:
当不知道返回给页面的所需参数时,我们可以查看针对源码的js文件看其ajax请求。以video.js为例 |
When uploading a video, you need to set the size of the uploaded video application.properties
# The size of the file upload allowed spring.http.multipart.maxFileSize = 100Mb spring.http.multipart.maxRequestSize = 100Mb |
Results: