In SpringMVC, why does the foreground pass in one parameter and controller accepts two parameters?

topic description

Why does the foreground pass in one parameter in SpringMVC, but controller accepts two parameters?
doesn"t understand this all the time. I hope you can help me.

background:

@PostMapping("/uploadFace")
    public JSONResult uploadFace(String userId, @RequestParam("file") MultipartFile[] files) throws IOException {

Front desk:

 wx.uploadFile({
          url: serverUrl + "/user/uploadFace?userId=" + app.userInfo.id,
          filePath: tempFilePaths[0],
          name: "file",
          header: {
            "content-type": "application/json"
          }
Jun.08,2022
The

parameter is not necessarily on the url, you can also use the post form to submit you to see if there is a file < input > tag


after you encounter this problem, you can directly click in to see the source code of Spring.
you will see that he parses not only the content of queryString, but also the content of body.
in other words, the result depends on the Spring framework, which may not be the case if you change the framework, so look at the source code analysis for yourself.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bc349c-3065f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bc349c-3065f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?