System Information
- Strapi Version: 4.10.5
- Operating System: Windows Server 2019
- Database: MySQL
- Node Version: v18.13.0
- NPM Version: 8.19.3
- Yarn Version: -
Hi,
How can i create custom upload endpoint? I am looking for the strapi upload service where I can POST to from my React Application with axios like:
const uploadSignedPdf = async (offerte, blob, filename) => {
var formData = new FormData();
formData.append('files', blob, filename);
try {
const response = await api.post('/offertes/upload', formData, {
headers: {
"Content-Type": "multipart/form-data"
}
});
if (response.data) {
console.log(response.data);
}
} catch (error) {
console.log(error)
}
}
So it is for my offerte
model. This code works fine when using the default strapi /upload
endpoint but how can I create it custom for me because I want to do some extra things in it.
I already added the custom route:
{
method: 'POST',
path: '/offertes/upload',
handler: 'offerte.uploadSignedOfferte',
config: {
controllers: [
"api::offerte.offerte"
]
}
},