【发布时间】:2020-08-09 13:03:56
【问题描述】:
我想将使用multipart/form-data从客户端发送的图像的URL存储在我的MySQL数据库中。我关注了文档,但我真的不知道应该如何在服务器文件系统中保存图像并将 URL 返回给客户端。
这是我的代码:
@ApiTags('product-image')
@Controller('product-image')
export class ProductImageController {
constructor(public service: ProductImageService) {
}
@Post('upload')
@UseInterceptors(FilesInterceptor('files'))
uploadImage(@UploadedFiles() files) {
console.log(files);
// How can I save image files in
// a custom path and return the path
// back to the client?
}
}
【问题讨论】:
标签: javascript mysql node.js nestjs