dzzzzzy / Nestjs-Learning

nestjs 学习教程 :books:,跟我一起学习 nest 框架~ :muscle:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

上传文件时的异常

Surile opened this issue · comments

  @UseInterceptors(
    FileInterceptor('file',{
      limits: {
        fieldSize: 10,
      },
    }),
  )
  async searchImage(@UploadedFile() file, @Body() params) {
    const data = file.buffer.toString('base64');
    return await this.imageService.imageClassfiy(params.token, data);
  }

image

nestjs上传文件的大小是1m,设置之后报Field value too long,这种情况如何解决。