保存进度!
This commit is contained in:
		@@ -75,6 +75,12 @@
 | 
				
			|||||||
      <artifactId>commons-fileupload</artifactId>
 | 
					      <artifactId>commons-fileupload</artifactId>
 | 
				
			||||||
      <version>1.4</version>
 | 
					      <version>1.4</version>
 | 
				
			||||||
    </dependency>
 | 
					    </dependency>
 | 
				
			||||||
 | 
					    <!-- https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api -->
 | 
				
			||||||
 | 
					    <dependency>
 | 
				
			||||||
 | 
					      <groupId>javax.annotation</groupId>
 | 
				
			||||||
 | 
					      <artifactId>javax.annotation-api</artifactId>
 | 
				
			||||||
 | 
					      <version>1.3.2</version>
 | 
				
			||||||
 | 
					    </dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  </dependencies>
 | 
					  </dependencies>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
 * @Author: Kane
 | 
					 * @Author: Kane
 | 
				
			||||||
 * @Date: 2022-09-28 15:47:02
 | 
					 * @Date: 2022-09-28 15:47:02
 | 
				
			||||||
 * @LastEditors: Kane
 | 
					 * @LastEditors: Kane
 | 
				
			||||||
 * @LastEditTime: 2022-10-11 09:40:45
 | 
					 * @LastEditTime: 2022-10-11 11:06:56
 | 
				
			||||||
 * @FilePath: \car_dealer\src\main\java\com\cpic\xim\car_dealer\controllers\fileupload\FileUploadController.java
 | 
					 * @FilePath: \car_dealer\src\main\java\com\cpic\xim\car_dealer\controllers\fileupload\FileUploadController.java
 | 
				
			||||||
 * @Description: 用于实现跨域功能的过滤器对象。
 | 
					 * @Description: 用于实现跨域功能的过滤器对象。
 | 
				
			||||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
					 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
				
			||||||
@@ -13,6 +13,7 @@ package com.cpic.xim.car_dealer.controllers.fileupload;
 | 
				
			|||||||
import java.io.File;
 | 
					import java.io.File;
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.nio.channels.IllegalSelectorException;
 | 
					import java.nio.channels.IllegalSelectorException;
 | 
				
			||||||
 | 
					import javax.annotation.PostConstruct;
 | 
				
			||||||
import javax.servlet.http.HttpServletRequest;
 | 
					import javax.servlet.http.HttpServletRequest;
 | 
				
			||||||
import javax.servlet.http.HttpServletResponse;
 | 
					import javax.servlet.http.HttpServletResponse;
 | 
				
			||||||
import org.springframework.context.annotation.Scope;
 | 
					import org.springframework.context.annotation.Scope;
 | 
				
			||||||
@@ -26,6 +27,17 @@ import org.springframework.web.multipart.MultipartFile;
 | 
				
			|||||||
@RequestMapping( path = "/upload")
 | 
					@RequestMapping( path = "/upload")
 | 
				
			||||||
public class FileUploadController
 | 
					public class FileUploadController
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    @PostConstruct
 | 
				
			||||||
 | 
					    public void init()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        // WebApplicationContext webApplicationContext =
 | 
				
			||||||
 | 
					        // ContextLoader.getCurrentWebApplicationContext();
 | 
				
			||||||
 | 
					        // ServletContext servletContext = webApplicationContext.getServletContext();
 | 
				
			||||||
 | 
					        // String realPath = servletContext.getRealPath( "" );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // System.out.println( realPath );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*****************************************************
 | 
					    /*****************************************************
 | 
				
			||||||
     * 接收上传文件,并保存到临时目录:
 | 
					     * 接收上传文件,并保存到临时目录:
 | 
				
			||||||
     * 1、临时目录下再用sessionID作为子目录保存文件。
 | 
					     * 1、临时目录下再用sessionID作为子目录保存文件。
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
 * @Author: Kane
 | 
					 * @Author: Kane
 | 
				
			||||||
 * @Date: 2022-09-29 16:33:30
 | 
					 * @Date: 2022-09-29 16:33:30
 | 
				
			||||||
 * @LastEditors: Kane
 | 
					 * @LastEditors: Kane
 | 
				
			||||||
 * @LastEditTime: 2022-10-09 10:24:17
 | 
					 * @LastEditTime: 2022-10-11 10:08:30
 | 
				
			||||||
 * @FilePath: \car_dealer\src\main\webapp\file_upload.html
 | 
					 * @FilePath: \car_dealer\src\main\webapp\file_upload.html
 | 
				
			||||||
 * @Description: 
 | 
					 * @Description: 
 | 
				
			||||||
 * 
 | 
					 * 
 | 
				
			||||||
@@ -78,6 +78,8 @@
 | 
				
			|||||||
            };
 | 
					            };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            xhr.onload = function (event) {
 | 
					            xhr.onload = function (event) {
 | 
				
			||||||
 | 
					                console.log(xhr.responseText);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                let result = JSON.parse(xhr.responseText);
 | 
					                let result = JSON.parse(xhr.responseText);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                console.log(result);
 | 
					                console.log(result);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user