当前位置:网站首页>微信小程序uploadfile服务器,微信小程序之wx.uploadFile[通俗易懂]
微信小程序uploadfile服务器,微信小程序之wx.uploadFile[通俗易懂]
2022-07-06 16:30:00 【Java架构师必看】
大家好,我是架构君,一个会写代码吟诗的架构师。今天说一说微信小程序uploadfile服务器,微信小程序之wx.uploadFile[通俗易懂],希望能够帮助大家进步!!!
wx.uploadFile(Object object)
将本地资源上传到服务器。客户端发起一个 HTTPS POST 请求,其中 content-type 为 multipart/form-data
url:开发者服务器地址
filePath:要上传文件资源的路径
name:文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容
header:HTTP 请求 Header,Header 中不能设置 Referer
formData:HTTP 请求中其他额外的 form data
success:接口调用成功的回调函数
fail:接口调用失败的回调函数
complete:接口调用结束的回调函数(调用成功、失败都会执行)
实例
wx.chooseImage({
success (res) {
const tempFilePaths = res.tempFilePaths
wx.uploadFile({
url: 'https://example.weixin.qq.com/upload',
filePath: tempFilePaths[0],
name: 'file',
formData: {
'user': 'test'
},
success (res){
const data = res.data
//do something
}
})
}
})
边栏推荐
- DAY SIX
- Stop saying that microservices can solve all problems
- 电脑重装系统u盘文件被隐藏要怎么找出来
- [212] what are three methods for PHP to send post requests
- 【系统分析师之路】第七章 复盘系统设计(面向服务开发方法)
- The intranet penetrates the zerotier extranet (mobile phone, computer, etc.) to access intranet devices (raspberry pie, NAS, computer, etc.)
- Today's sleep quality record 78 points
- [OFDM communication] OFDM system signal detection based on deep learning with matlab code
- 设计一个抢红包系统
- Experiment 4: installing packages from Gui
猜你喜欢
JDBC programming of MySQL database
1000字精选 —— 接口测试基础
[unmanned aerial vehicle] multi unmanned cooperative task allocation program platform, including Matlab code
Wind chime card issuing network source code latest version - commercially available
Tourism Management System Based on jsp+servlet+mysql framework [source code + database + report]
MySQL implementation of field segmentation from one line to multiple lines of example code
How to implement Lua entry of API gateway
leetcode:236. 二叉树的最近公共祖先
Matplotlib draws a histogram and adds values to the graph
Rider离线使用Nuget包的方法
随机推荐
17、 MySQL - high availability + read / write separation + gtid + semi synchronous master-slave replication cluster
【2022全网最细】接口测试一般怎么测?接口测试的流程和步骤
Local deployment Zeppelin 0.10.1
Leetcode problem solving - 889 Construct binary tree according to preorder and postorder traversal
The programmer refused the offer because of low salary, HR became angry and netizens exploded
[communication] optimal power allocation in the uplink of two-layer wireless femtocell network with matlab code
If the request URL contains jsessionid, the solution
Scholar doctor hahaha
[system analyst's road] Chapter 7 double disk system design (service-oriented development method)
How does crmeb mall system help marketing?
Wasserstein slim gain with gradient poverty (wsgain-gp) introduction and code implementation -- missing data filling based on generated countermeasure network
Design a red envelope grabbing system
求帮助xampp做sqlilab是一片黑
How can Oracle CDC deserialize with jsondebeziumdeserializationschema
DevOps可以帮助减少技术债务的十种方式
MATLIB reads data from excel table and draws function image
app通用功能測試用例
openresty ngx_lua子请求
The tutorial of computer reinstallation win10 system is simple and easy to understand. It can be reinstalled directly without U disk
What should I do if the USB flash disk data is formatted and how can I recover the formatted USB flash disk data?