-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSummerNoteController.java
64 lines (53 loc) · 2.25 KB
/
SummerNoteController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package net.liuxuan.SprKi.controller.utils;
import net.liuxuan.utils.upload.UploadUtil;
import org.apache.commons.logging.Log;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import static org.apache.commons.logging.LogFactory.getLog;
/**
* Copyright (c) 2010-2016. by Liuxuan All rights reserved. <br/>
* ***************************************************************************
* 源文件名: net.liuxuan.SprKi.controller.utils.SummerNoteController
* 功能:
* 版本: @version 1.0
* 编制日期: 2016/11/11 10:21
* 修改历史: (主要历史变动原因及说明)
* YYYY-MM-DD | Author | Change Description
* 2016/11/11 | Moses | Created
*/
@Controller
public class SummerNoteController {
@Value("${SprKi.upload.savepathroot}")
private String picSavePathRoot;
@Value("${SprKi.upload.savepathchild}")
private String picSavePathChild;
@Value("${SprKi.upload.accesspath}")
private String picAccessPath;
/**
* The Context.
*/
// @Autowired
// ServletContext context;
/**
* @param files
* @param request
* @param response
* @throws IOException
*/
@RequestMapping(value = "/utils/uploadMultipleFile", method = RequestMethod.POST, produces = "application/json;charset=utf8")
@ResponseBody
public void uploadMultipleFileHandler(@RequestParam("file") MultipartFile[] files, HttpServletRequest request, HttpServletResponse response) throws IOException {
// File path = new File(picSavePathRoot + picSavePathChild +"/");
// String back = UploadUtil.uploadImage(request.getServletContext().getRealPath("/"), files);
String back = UploadUtil.uploadImage(picSavePathRoot + picSavePathChild + "/", picAccessPath, files);
response.getWriter().write(back);
}
}