实现作业上传自动创建文件夹
This commit is contained in:
@@ -6,6 +6,7 @@ import com.fjy.spring.exception.UserException;
|
||||
import com.fjy.spring.service.WorkDetailService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
@@ -25,4 +26,9 @@ public class DataController {
|
||||
new UserException(ResultEnum.EMPTY_DATA);
|
||||
return null;
|
||||
}
|
||||
|
||||
@PostMapping("/home/dofeedback")
|
||||
public void doFeedback(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,19 @@ public class NavController {
|
||||
public String toHomePage(){
|
||||
return "/home/home";
|
||||
}
|
||||
|
||||
@GetMapping(value = {"/feedback"})
|
||||
public String toFeedbackPage(){
|
||||
return "/home/feedback";
|
||||
}
|
||||
|
||||
@GetMapping(value = {"/about"})
|
||||
public String toAboutPage(){
|
||||
return "/home/about";
|
||||
}
|
||||
|
||||
@GetMapping(value = {"/user"})
|
||||
public String toUserPage(){
|
||||
return "/home/user";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user