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 # temp data
__data __data
# 我想把upload文件夹传上去 # 我想把upload文件夹传上去
/upload/* /public/upload/*
!/upload/.gitkeep !/public/upload/.gitkeep
types/env.d.ts types/env.d.ts

View File

View File

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