小程序上传图片到服务器

通过wx.chooseImage或者第三方插件获取选择图片的临时地址

小程序端上传

 wx.uploadFile({
          url: '服务器上传图片接口',
          filePath: that.data.fileList[0].url,//获取的图片临时路径
          name: 'file',//图片标识,后台可用标识获取该图片,也可以用下标获取
          success(res) {
            console.log(res);
            },
            fail(res){
              console.log(res);
            }
        });

C# api接口处理

//UploadConfig.UploadImg为C# 上传图片方式
string  reportImgUrl="服务器存储图片地址";
var file = HttpContext.Current.Request.Files[0];
                //var file = HttpContext.Current.Request.Files["file"];
                var value = UploadConfig.UploadImg(file , UploadConfig.reportImgUrl);
原文地址:https://www.cnblogs.com/ThisYbc/p/15441487.html