This commit is contained in:
louis 2024-04-07 11:25:27 +08:00
parent 5ac2b7b0d0
commit 8940154aee
3 changed files with 13 additions and 12 deletions

4
.gitignore vendored
View File

@ -73,6 +73,6 @@ out
# temp data
__data
# 我想把upload文件夹传上去
/upload/*
!/upload/.gitkeep
/public/upload/*
!/public/upload/.gitkeep
types/env.d.ts

View File

View File

@ -8,14 +8,15 @@ import { IsFile } from './file.constraint';
export class FileUploadDto {
@ApiProperty({ type: Buffer, format: 'binary', description: '文件' })
@IsDefined()
@IsFile(
{
mimetypes: ['image/png', 'image/gif', 'image/jpeg', 'image/webp', 'image/svg+xml'],
fileSize: 1024 * 1024 * 10
},
{
message: '文件类型不正确'
}
)
// @IsFile(//
// {
// mimetypes: ['image/png', 'image/gif', 'image/jpeg', 'image/webp', 'image/svg+xml','apk'],
// // 改成30m
// fileSize: 30 * 1024 * 1024 * 1024 * 1024// 30MB
// },
// {
// message: '文件类型不正确'
// }
// )
file: MultipartFile;
}