WeChat applet uploads pictures to the server

The postman test succeeds when the header is not added

The contenttype is specified in the official tutorial, but the header is not required

This makes me a little confused, I don't know if I should write the header~
and then look at the code, I feel that there is no problem. Anyway, calling the API back and forth is just those few sentences:

   wx.uploadFile({
      url: 'url',
      filePath: that.data.imageSrc1[0],
      name: 'file',
      // formData: {
      //   'UUID':uuid.v1(),
      //   'phone':app.globalData.phone,
      //   'type':'before_picture',
      //   'missionID':this.data.missionID,
      //   'size':this.data.size1,
      //   'filename':'执行前照片'
      // },
      header: {
        'content-type': 'multipart/form-data' // 默认值
      },
      method: 'POST',
      success: function (res) {
        console.log(res.statusCode)

Don't know how to debug?
A statement to print the failure message is added to the code

fail:function(res){
        console.log(res)
      },

It prints as follows:
There is a problem with the certificate, embarrassing

After Baidu for a long time, I saw another article saying that there is a problem with uploading and downloading files for local debugging of small programs, and it must be previewed~ Original

So a preview:
ssl hand shake error

Well, continue to search for the ssl hand shake error problem and see one that says to configure TLS version 1.2 on the server and disable versions below 1.2.

Going around, I found a new problem with the certificate:
WeChat applet my way to fill the hole - request request:
1. Must use domain name, not ip
2. Must use port 443
3. Must have https
4. Must be in The domain name is configured in the background of the applet (the file must be configured separately, and the file can only be tested on the real machine)
5. The domain name must be recorded
6. Online detection of ssl certificate is missing
7. TLS must support version 1.2

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325347871&siteId=291194637