I'm trying to send json with image to another api from my nesjs api, I'm using httpservice.post but always getting an error - "no file supplied".
the image is ulpoaded from the user and saved in the public folder, then I try to get the image from the folder and send it to the api.
in the remote api they expect - raw data image and Content-Type: multipart/form-data in the header, I tried both but it doesn't work.
this is the code:
const image = await fs.createReadStream(`./public/storage/images/${image.filename}`);
let imageData = {
"file": image,
"caption": tag,
"isLogo": false
}
const res = await this.httpService.post(
`${urlapi}`,
imageData,
{
headers: {
"Authorization": `Bearer ${access_token}`,
"Content-Type": "application/json"
}
}
)
.toPromise();
I'm new at nestjs and node, I would really appreciate some help.