diff --git a/code/java/car_dealer/.hintrc b/code/java/car_dealer/.hintrc
index 5b02c11..0eef3be 100644
--- a/code/java/car_dealer/.hintrc
+++ b/code/java/car_dealer/.hintrc
@@ -8,6 +8,7 @@
{
"label": "off"
}
- ]
+ ],
+ "no-inline-styles": "off"
}
}
\ No newline at end of file
diff --git a/code/java/car_dealer/src/main/java/com/cpic/xim/car_dealer/controllers/fileupload/FileUploadController.java b/code/java/car_dealer/src/main/java/com/cpic/xim/car_dealer/controllers/fileupload/FileUploadController.java
index 7f22c0e..ebaafe4 100644
--- a/code/java/car_dealer/src/main/java/com/cpic/xim/car_dealer/controllers/fileupload/FileUploadController.java
+++ b/code/java/car_dealer/src/main/java/com/cpic/xim/car_dealer/controllers/fileupload/FileUploadController.java
@@ -2,7 +2,7 @@
* @Author: Kane
* @Date: 2022-09-28 15:47:02
* @LastEditors: Kane
- * @LastEditTime: 2022-09-30 00:33:41
+ * @LastEditTime: 2022-09-30 10:45:27
* @FilePath: \car_dealer\src\main\java\com\cpic\xim\car_dealer\controllers\fileupload\FileUploadController.java
* @Description:
*
@@ -25,10 +25,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
@Controller
-@Scope( "session" )
+@Scope( "session")
+@RequestMapping( path = "/upload")
public class FileUploadController
{
- @RequestMapping( value = "/test" )
+ @RequestMapping( value = "/test.do")
public void test() throws ServletException, IOException
{
// PrintWriter writer = response.getWriter();
@@ -42,20 +43,22 @@ public class FileUploadController
* @param uploadFile
* @return FileUploadResult
*****************************************************/
- @RequestMapping( path = "/upload" )
+ @RequestMapping( path = "/upload_file.do")
@ResponseBody
@CrossOrigin
- public FileUploadResult uploadFile( HttpServletRequest request, MultipartFile uploadFile,
- String test ) throws IllegalSelectorException, IOException
+ public FileUploadResult uploadFile( HttpServletRequest request, HttpServletResponse response,
+ MultipartFile uploadFile, String test ) throws IllegalSelectorException, IOException
{
// response.setContentType( "text/json;charset=UTF-8" );
// response.setHeader( "Access-Control-Allow-Origin", "*" );
// response.setHeader( "Access-Control-Allow-Methods", "GET,POST" );
+ request.getCookies();
+
FileUploadResult result = new FileUploadResult();
String sessionID = request.getSession().getId();
- if ( uploadFile == null )
+ if ( uploadFile == null)
{
result.setSuccess( false );
result.setMessage( "请用于上传文件!" );
@@ -63,7 +66,7 @@ public class FileUploadController
return result;
}
- if ( uploadFile.isEmpty() )
+ if ( uploadFile.isEmpty())
{
result.setSuccess( false );
result.setMessage( "上传空文件!" );
@@ -72,16 +75,16 @@ public class FileUploadController
}
// 使用sessionID来作为存放的目录
- String rootPath = request.getServletContext().getRealPath( "/" + sessionID );
+ String rootPath = request.getServletContext().getRealPath( "/temp/upload/" + sessionID );
String fileName = uploadFile.getOriginalFilename();
File destFile = new File( rootPath, fileName );
// 判断路径是否存在,不存在就创建。
- if ( !destFile.getParentFile().exists() )
+ if ( !destFile.getParentFile().exists())
{
// 创建路径
- if ( !destFile.getParentFile().mkdirs() )
+ if ( !destFile.getParentFile().mkdirs())
{
// 如果创建路径失败
result.setSuccess( false );
diff --git a/code/java/car_dealer/src/main/webapp/WEB-INF/classes/spring.xml b/code/java/car_dealer/src/main/webapp/WEB-INF/classes/spring.xml
index 3078e41..67ae7ed 100644
--- a/code/java/car_dealer/src/main/webapp/WEB-INF/classes/spring.xml
+++ b/code/java/car_dealer/src/main/webapp/WEB-INF/classes/spring.xml
@@ -19,8 +19,8 @@
-->