12345678910111213141516171819202122232425 |
- package com.controller;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.CookieValue;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
- import org.springframework.web.multipart.MultipartFile;
- import javax.servlet.http.HttpServletRequest;
- import java.io.File;
- import java.io.IOException;
- @Controller
- public class UploadFileController {
- // http://localhost:8083/template/upload_file.jsp
- @RequestMapping("/uploadFile")
- @ResponseBody
- public String uploadFile (String name, MultipartFile file1) throws IOException {
- System.out.println(12312);
- String originalFilename = file1.getOriginalFilename();
- file1.transferTo(new File("D:\\javaProject\\" + originalFilename));
- return "upload_file";
- }
- }
|