实现作业上传自动创建文件夹

This commit is contained in:
F嘉阳
2018-02-07 15:28:51 +08:00
parent 62d38ac480
commit 06ba589dfd
8 changed files with 204 additions and 31 deletions

View File

@@ -122,7 +122,9 @@ public class UpLoadController {
* @return
*/
@RequestMapping("/moreUpload")
public void moreUpload(HttpServletRequest request) {
public void moreUpload(HttpServletRequest request,
@RequestParam(value = "courseName",required = false) String courseName,
@RequestParam(value = "folder",required = false) String folder) {
MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> files = multipartHttpServletRequest.getFileMap();
@@ -132,7 +134,7 @@ public class UpLoadController {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateNowStr = sdf.format(date);
//String uploadUrl = request.getSession().getServletContext().getRealPath("/") + "upload/";
String uploadUrl = serverProperties.getFilePath()+ "upload/";
String uploadUrl = serverProperties.getFilePath()+ "upload/"+courseName+"/"+folder+"/";
File dir = new File(uploadUrl);
if (!dir.exists()) {