You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.0 KiB
42 lines
1.0 KiB
package com.nov.KgLowDurable.config; |
|
import org.springframework.beans.factory.annotation.Value; |
|
import org.springframework.stereotype.Component; |
|
/** |
|
* @author: liweidong |
|
* @create: 2025-12-31 |
|
*/ |
|
@Component |
|
public class FileUploadConfig { |
|
|
|
// 本地服务器地址 |
|
@Value("${file.upload.server:http://localhost:8083}") |
|
private String serverUrl; |
|
|
|
// 基础存储路径 |
|
@Value("${file.upload.base-path:/opt/SmartParkFilesTest}") |
|
private String basePath; |
|
|
|
// 允许的文件类型 |
|
@Value("${file.upload.allowed-types:jpg,jpeg,png,gif,bmp}") |
|
private String allowedTypes; |
|
|
|
// 最大文件大小(MB) |
|
@Value("${file.upload.max-size:10}") |
|
private long maxFileSize; |
|
|
|
public String getServerUrl() { |
|
return serverUrl; |
|
} |
|
|
|
public String getBasePath() { |
|
return basePath; |
|
} |
|
|
|
public String[] getAllowedTypes() { |
|
return allowedTypes.split(","); |
|
} |
|
|
|
public long getMaxFileSize() { |
|
return maxFileSize * 1024 * 1024; // 转换为字节 |
|
} |
|
}
|
|
|