'Uploading Image to SupaBase using Node ts
I'm facing issue uploading image to SupaBase bucket. I'm uploading image via postman post method and using formidable package to receive image and using SupaBase upload function to upload the image but the image is being uploaded with size 0/15 bytes. I'm doing this in the following way. Any help will be highly appreciated.
var form = new formidable.IncomingForm();
form.parse(req, async function (err: any, fields: any, files: any) {
const avatarFile = files.image;
const fileName = `public/image1${Date.now()}.png`;
const { data, error } = await supabase.storage
.from("avatars")
.upload(fileName, avatarFile,{
contentType:'image/png',
cacheControl: '3600',
upsert: false
})
if (error) {
return res.send(error);
} else {
return res.send(data);
}
});
};```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
