保存进度!
This commit is contained in:
		@@ -75,6 +75,12 @@
 | 
			
		||||
      <artifactId>commons-fileupload</artifactId>
 | 
			
		||||
      <version>1.4</version>
 | 
			
		||||
    </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>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2022-09-28 15:47:02
 | 
			
		||||
 * @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
 | 
			
		||||
 * @Description: 用于实现跨域功能的过滤器对象。
 | 
			
		||||
 * 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.IOException;
 | 
			
		||||
import java.nio.channels.IllegalSelectorException;
 | 
			
		||||
import javax.annotation.PostConstruct;
 | 
			
		||||
import javax.servlet.http.HttpServletRequest;
 | 
			
		||||
import javax.servlet.http.HttpServletResponse;
 | 
			
		||||
import org.springframework.context.annotation.Scope;
 | 
			
		||||
@@ -26,6 +27,17 @@ import org.springframework.web.multipart.MultipartFile;
 | 
			
		||||
@RequestMapping( path = "/upload")
 | 
			
		||||
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作为子目录保存文件。
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2022-09-29 16:33:30
 | 
			
		||||
 * @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
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
@@ -78,6 +78,8 @@
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            xhr.onload = function (event) {
 | 
			
		||||
                console.log(xhr.responseText);
 | 
			
		||||
 | 
			
		||||
                let result = JSON.parse(xhr.responseText);
 | 
			
		||||
 | 
			
		||||
                console.log(result);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user