Я хочу сохранить URL
изображений, отправленных клиентом с помощью multipart/form-data
, в моей базе данных 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?
}
}