Uploading image from nuxt to strapi

Viewed 420

I have a project that I need Users to add 10 pictures from the NUXT frontend to their profile as their id but in 10 different fields (single pictures). and I want the old picture to be deleted when they add a picture to the same field again.

I'm using Axios to post that image from a frontend like;

    handleFileUpload(){
        this.file = this.$refs.file[0];
        
    },
    async upload(){
        if (process.browser) {
            let formData = new FormData();
            formData.append('file', this.file);
            await Axios.post ("http://localhost:1337/upload",
            formData,
            {
                headers: {
                    'Content-Type': 'multipart/form-data',
                }
            }
        )}
    },

I'm sure this file has been set to the right value because I logged into the console.

Maybe something is wrong with my API request. I'm getting a 400 bad request with a message of

    errors: [{ id: ‘Upload.status.disabled’, message: ‘File upload is disabled’ }]
0 Answers
Related