保存进度!
This commit is contained in:
parent
c568da745f
commit
5f829dba7a
@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2023-01-22 23:11:26
|
* @Date: 2023-01-22 23:11:26
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @LastEditTime: 2023-01-24 00:35:02
|
* @LastEditTime: 2023-01-24 00:55:08
|
||||||
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\controllers\FileUpload\FileUpload.java
|
* @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\controllers\FileUpload\FileUpload.java
|
||||||
* @Description: 用于接受上传文件的Controller。
|
* @Description: 用于接受上传文件的Controller。
|
||||||
*
|
*
|
||||||
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
package com.cpic.xim.web.controllers.FileUpload;
|
package com.cpic.xim.web.controllers.FileUpload;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@ -56,15 +57,18 @@ public class FileUpload
|
|||||||
|
|
||||||
for ( MultipartFile file : files )
|
for ( MultipartFile file : files )
|
||||||
{
|
{
|
||||||
|
// 检查文件长度,如果为0则跳过
|
||||||
if ( file.isEmpty() )
|
if ( file.isEmpty() )
|
||||||
{
|
{
|
||||||
// 文件长度位0,跳过
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 保存文件到临时目录
|
||||||
String filePath =
|
String filePath =
|
||||||
request.getServletContext().getRealPath( "/temp/upload/" + sessionID );
|
request.getServletContext().getRealPath( "/temp/upload/" + sessionID );
|
||||||
String fileName = file.getOriginalFilename();
|
String fileName = file.getOriginalFilename();
|
||||||
|
File destFile = new File( filePath, fileName );
|
||||||
|
|
||||||
fileNames.add( file.getOriginalFilename() );
|
fileNames.add( file.getOriginalFilename() );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user