|
|
|
@ -2087,6 +2087,13 @@ export class CollectionToolsBuildingComponent implements OnInit {
|
|
|
|
|
let fileSize = file.size || null //上传文件的总大小
|
|
|
|
|
let maxSize = 5 * 1024 * 1024 //5MB一个分片
|
|
|
|
|
let tenSize = 10 * 1024 * 1024 //10MB限制
|
|
|
|
|
if (file && file.name.toLowerCase().indexOf('png') == -1 && file.name.toLowerCase().indexOf('jpg') == -1 && file.name.toLowerCase().indexOf('jpeg') == -1) { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('请上传图片后缀为png,jpg,jpeg的文件', '确定', config); |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (file && fileSize <= maxSize) { //上传文件<=5MB时
|
|
|
|
|
let formData = new FormData() |
|
|
|
|