当前位置:网站首页>微信小程序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
}
})
}
})
边栏推荐
- (LeetCode)两数之和
- DevOps可以帮助减少技术债务的十种方式
- [OFDM communication] OFDM system signal detection based on deep learning with matlab code
- Interface joint debugging test script optimization v4.0
- SuperSocket 1.6 创建一个简易的报文长度在头部的Socket服务器
- [communication] optimal power allocation in the uplink of two-layer wireless femtocell network with matlab code
- 【系统分析师之路】第七章 复盘系统设计(面向服务开发方法)
- 谁说新消费品牌大溃败?背后有人赢麻了
- 快讯 l Huobi Ventures与Genesis公链深入接洽中
- A novice asks a question. I am now deployed on a single machine. I submitted an SQL job and it runs normally. If I restart the service job, it will disappear and I will have to
猜你喜欢
【精品】pinia 基于插件pinia-plugin-persist的 持久化
Why is bat still addicted to 996 when the four-day working system is being tried out in Britain?
STM32通过串口进入和唤醒停止模式
leetcode:236. 二叉树的最近公共祖先
Master binary tree in one article
基于jsp+servlet+mysql框架的旅游管理系统【源码+数据库+报告】
JDBC programming of MySQL database
Hydrogen future industry accelerates | the registration channel of 2022 hydrogen energy specialty special new entrepreneurship competition is opened!
Today, I met a senior test developer from Tencent and saw the ceiling of the foundation
The worse the AI performance, the higher the bonus? Doctor of New York University offered a reward for the task of making the big model perform poorly
随机推荐
短链的设计
Experiment 5: common automation libraries
【系统分析师之路】第七章 复盘系统设计(面向服务开发方法)
The "white paper on the panorama of the digital economy" has been released with great emphasis on the digitalization of insurance
The method of reinstalling win10 system is as simple as that
Eureka Client启动后就关闭 Unregistering application xxx with eureka with status DOWN
吴恩达2022机器学习课程评测来了!
Zero code and high return. How to use 40 sets of templates to meet 95% of the reporting needs in the work
Compile logisim
Every year, 200 billion yuan is invested in the chip field, and "China chip" venture capital is booming
设计一个抢红包系统
Detailed explanation of regular expression (regexp) in MySQL
Server SMP, NUMA, MPP system learning notes.
[212] what are three methods for PHP to send post requests
app通用功能测试用例
DAY SIX
自动化测试工具Katalon(Web)测试操作说明
Common modification commands of Oracle for tables
Wasserstein slim gain with gradient poverty (wsgain-gp) introduction and code implementation -- missing data filling based on generated countermeasure network
[system analyst's road] Chapter 7 double disk system design (service-oriented development method)