Iview Upload component uploads pictures and reports 500Error.

this is the code
< template >

<div>
    <Upload
        type="select"
        action="http://192.168.1.149:8080/upload/image"
        :headers ="{"Content-Type": "multipart/form-data"}"
        :data="datas"
        :with-credentials="true"
        :before-upload="beforeUpload"
        >
        <div style="padding: 20px 100px">
            <Icon type="ios-cloud-upload" size="52" style="color: -sharp3399ff"></Icon>
            

</div> </Upload> </div>

< / template >

< script >

export default {
    data(){
        return {
            datas:{
                image: null,
                type: 4
            }
        }
    },
    methods:{
        beforeUpload(file){
            this.datas.image = file;
            
            console.log(this.datas)
        }
    }
}

< / script >

this is an error

clipboard.png

problem description

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Apr.02,2021

what is obvious is that the interface reported an error. We should start with the back-end interface to find out the reason, that is,

http://192.168.1.149:8080/upload/image

Thank you, found the reason, do not add: headers = "{'Content-Type':' multipart/form-data'}"

Menu