Home > Back-end >  SSM file upload null pointer exception
SSM file upload null pointer exception

Time:09-27




Very urgent commercial can help to have a look, you really don't understand something wrong

CodePudding user response:

You processData in front-end code: false added

CodePudding user response:

UploadFile function (event) {
Var _that=this;
//obtain input the content of the
Var file=document. QuerySelector (" # fileUpload "). The files [0]

//create the formData object ()
Var formData=https://bbs.csdn.net/topics/new formData ()
//add the contents of the input to the formData () object in
FormData. Append (" file ", file)

//use jquey ajax to send a post request
$. Ajax ({
Url: "/manage/tjBoxShare/import,"
Type: "POST",
ContentType: false,
ProcessData: false,//must add
Data: formData,
Success: the function (res) {
The console. The log (res)

Alert (res) data) message)
}
})
},

CodePudding user response:

Big probability is a problem your front-end code

CodePudding user response:

refer to the second floor to mix mouth eat programmers reply:
uploadFile: function (event) {
Var _that=this;
//obtain input the content of the
Var file=document. QuerySelector (" # fileUpload "). The files [0]

//create the formData object ()
Var formData=https://bbs.csdn.net/topics/new formData ()
//add the contents of the input to the formData () object in
FormData. Append (" file ", file)

//use jquey ajax to send a post request
$. Ajax ({
Url: "/manage/tjBoxShare/import,"
Type: "POST",
ContentType: false,
ProcessData: false,//must add
Data: formData,
Success: the function (res) {
The console. The log (res)

Alert (res) data) message)
}
})
},


As you wrote this, but the front or a null pointer


CodePudding user response:

reference 1/f, mix mouth eat programmers reply:
you processData in front-end code: false added:

No, it is follow to do online, front is a form is submitted, then find according to the little brother wrote a downstairs, is still empty

CodePudding user response:

The uploadFile ID selector is wow, it's bad for you wow , not rigid practices, learn to apply
  • Related