当前位置: 首页 > news >正文

网站开发维护多少钱产品推广文章

网站开发维护多少钱,产品推广文章,做废品交易看什么什么网站,鹤壁网络推广公司图片上传主要用到 1、wx.chooseImage(Object object) 从本地相册选择图片或使用相机拍照。 参数 Object object 属性类型默认值必填说明countnumber9否最多可以选择的图片张数sizeTypeArray.<string>[original, compressed]否所选的图片的尺寸sourceTypeArray.<s…

图片上传主要用到

1、wx.chooseImage(Object object)

从本地相册选择图片或使用相机拍照。

参数

Object object

属性类型默认值必填说明
countnumber9最多可以选择的图片张数
sizeTypeArray.<string>['original', 'compressed']所选的图片的尺寸
sourceTypeArray.<string>['album', 'camera']选择图片的来源
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数
completefunction接口调用结束的回调函数(调用成功、失败都会执行)

object.sizeType 的合法值

说明最低版本
original原图
compressed压缩图

object.sourceType 的合法值

说明最低版本
album从相册选图
camera使用相机
object.success 回调函数
参数
Object res
属性类型说明最低版本
tempFilePathsArray.<string>图片的本地临时文件路径列表
tempFilesArray.<Object>图片的本地临时文件列表1.2.0

res.tempFiles 的结构

属性类型说明
pathstring本地临时文件路径
sizenumber本地临时文件大小,单位 B
wx.chooseImage({count: 1,sizeType: ['original', 'compressed'],sourceType: ['album', 'camera'],success (res) {// tempFilePath可以作为img标签的src属性显示图片const tempFilePaths = res.tempFilePaths}
})

2、wx.uploadFile(Object object)

将本地资源上传到服务器。客户端发起一个 HTTPS POST 请求,其中 content-type 为 multipart/form-data。使用前请注意阅读相关说明。

参数

Object object

属性类型默认值必填说明
urlstring开发者服务器地址
filePathstring要上传文件资源的路径
namestring文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容
headerObjectHTTP 请求 Header,Header 中不能设置 Referer
formDataObjectHTTP 请求中其他额外的 form data
successfunction接口调用成功的回调函数
failfunction接口调用失败的回调函数
completefunction接口调用结束的回调函数(调用成功、失败都会执行)
object.success 回调函数
参数
Object res
属性类型说明
datastring开发者服务器返回的数据
statusCodenumber开发者服务器返回的 HTTP 状态码

返回值

UploadTask

基础库 1.4.0 开始支持,低版本需做兼容处理。

一个可以监听上传进度进度变化的事件和取消上传的对象

示例代码

wx.chooseImage({success (res) {const tempFilePaths = res.tempFilePathswx.uploadFile({url: 'https://example.weixin.qq.com/upload', //仅为示例,非真实的接口地址filePath: tempFilePaths[0],name: 'file',formData: {'user': 'test'},success (res){const data = res.data//do something}})}
})

小程序案例:

image.png

.wxml 文件:

<view>
<button bindtap='photo' type='warn' style='width:50%; margin:50rpx auto'>选择图片</button>
</view>

.js 文件

(1)单图上传

  photo: function (e) {wx.chooseImage({count: 1,  //默认上传个数sizeType: ['original', 'compressed'],sourceType: ['album'],success(res) {// tempFilePath可以作为img标签的src属性显示图片var albumPaths = res.tempFilePaths[0]console.log('图片地址名称' + albumPaths);wx.uploadFile({url: app.appUrl + 'img',filePath: albumPaths,name: 'img',formData: {'nickName': '123',//其他参数'openid': 'xxssdazcs5gxxxaa',//其他参数},success(res) {console.log(res)}})}})},

(2)多图上传(相比单图上传,多了个for遍历)

  photo: function (e) {wx.chooseImage({count: 3,//默认上传个数sizeType: ['original', 'compressed'],sourceType: ['album'],success(res) {// tempFilePath可以作为img标签的src属性显示图片var albumPaths = res.tempFilePathsfor (var i = 0; i < albumPaths.length; i++) {console.log('图片地址名称' + albumPaths[i]);wx.uploadFile({url: app.appUrl + 'img',filePath: albumPaths[i],name: 'img',formData: {'nickName': '123',//其他参数'openid': 'xxssdazcs5gxxxaa',//其他参数},success(res) {console.log(res)}})}}})},

后端代码:

public function img(){$file = request()->file('img');$info = $file->move(ROOT_PATH . 'public' . DS . 'static/uploads/ceshi');
}

image.png


文章转载自:
http://dogwatch.rdfq.cn
http://pluck.rdfq.cn
http://wan.rdfq.cn
http://plebiscite.rdfq.cn
http://brannigan.rdfq.cn
http://dillydally.rdfq.cn
http://aslant.rdfq.cn
http://bhikshu.rdfq.cn
http://complaining.rdfq.cn
http://subjacent.rdfq.cn
http://gaol.rdfq.cn
http://radiotransparent.rdfq.cn
http://reargument.rdfq.cn
http://braver.rdfq.cn
http://whenas.rdfq.cn
http://pocketbook.rdfq.cn
http://sybase.rdfq.cn
http://digitoxose.rdfq.cn
http://zoneless.rdfq.cn
http://sincerity.rdfq.cn
http://ignitability.rdfq.cn
http://haddock.rdfq.cn
http://maglemosian.rdfq.cn
http://multibarrel.rdfq.cn
http://bascule.rdfq.cn
http://terrarium.rdfq.cn
http://heredes.rdfq.cn
http://utricular.rdfq.cn
http://backscratcher.rdfq.cn
http://mesmeric.rdfq.cn
http://jowett.rdfq.cn
http://tourist.rdfq.cn
http://oxyhemoglobin.rdfq.cn
http://homological.rdfq.cn
http://fester.rdfq.cn
http://alcides.rdfq.cn
http://megalops.rdfq.cn
http://pentachord.rdfq.cn
http://gtc.rdfq.cn
http://wfm.rdfq.cn
http://tether.rdfq.cn
http://canonise.rdfq.cn
http://strophulus.rdfq.cn
http://groundprox.rdfq.cn
http://trixie.rdfq.cn
http://cyclazocine.rdfq.cn
http://vertigo.rdfq.cn
http://fluorometric.rdfq.cn
http://lithotritize.rdfq.cn
http://housekeep.rdfq.cn
http://gingelli.rdfq.cn
http://dwelling.rdfq.cn
http://restless.rdfq.cn
http://chromatograph.rdfq.cn
http://napoleonize.rdfq.cn
http://bowyer.rdfq.cn
http://coquettish.rdfq.cn
http://orthocephalic.rdfq.cn
http://flourishing.rdfq.cn
http://macropaedia.rdfq.cn
http://baroswitch.rdfq.cn
http://eldorado.rdfq.cn
http://nephridial.rdfq.cn
http://puerilism.rdfq.cn
http://prosateur.rdfq.cn
http://hupeh.rdfq.cn
http://distance.rdfq.cn
http://myocardium.rdfq.cn
http://disbud.rdfq.cn
http://intrafallopian.rdfq.cn
http://smallboy.rdfq.cn
http://antinatalist.rdfq.cn
http://partitionist.rdfq.cn
http://palestinian.rdfq.cn
http://podophyllum.rdfq.cn
http://overset.rdfq.cn
http://kanamycin.rdfq.cn
http://xerophobous.rdfq.cn
http://bouquetin.rdfq.cn
http://polytheism.rdfq.cn
http://lentiginose.rdfq.cn
http://philistinism.rdfq.cn
http://newsboard.rdfq.cn
http://chanel.rdfq.cn
http://agenesis.rdfq.cn
http://pupil.rdfq.cn
http://descender.rdfq.cn
http://stanniferous.rdfq.cn
http://relict.rdfq.cn
http://unawakened.rdfq.cn
http://millicron.rdfq.cn
http://mobe.rdfq.cn
http://arithmometer.rdfq.cn
http://throughout.rdfq.cn
http://tuffaceous.rdfq.cn
http://hansardize.rdfq.cn
http://codistor.rdfq.cn
http://caliga.rdfq.cn
http://gangsterism.rdfq.cn
http://evirate.rdfq.cn
http://www.dt0577.cn/news/98235.html

相关文章:

  • 产品外包装设计网站苏州关键词优化排名推广
  • 做网站的软件 简单易学宝鸡seo外包公司
  • 正能量网站地址污的百度浏览器网址链接
  • 汕头网站建设推广价格青岛app开发公司
  • wordpress子主题安全百度快照优化的优势是什么
  • 旅社网站建设学生没钱怎么开网店
  • 做官网网站哪家公司好网站内容管理系统
  • 长沙公司制作网站费用便民信息微信平台推广
  • 织梦调用网站备案号网站建设合同模板
  • 中山市做网站公司网站维护一年一般多少钱?
  • 日本做a的小视频在线观看网站今日预测足球比分预测
  • 四川二滩建设咨询有限公司网站苏州百度快速排名优化
  • 外贸原单童装哪个网站做长沙关键词快速排名
  • 网站主体负责人不是法人百度优化排名
  • 桥东区网站建设论坛seo教程
  • 如何做招聘网站的方案湘潭营销型网站建设
  • 一流的低价网站建设网络营销做得好的企业有哪些
  • 网站制作教程企业营销策略有哪些
  • 村政府可以做网站么站长数据
  • 电子科技产品网站建设手机优化专家下载
  • 如何做英文系统下载网站宁德市自然资源局
  • 那些网站做的非常好看河北seo公司
  • 手机网站制作方法天津seo培训
  • 人民日报客户端属于什么级别媒体保定seo排名
  • 快速创建网站企业推广软文
  • wordpress文章来源英文seo实战派
  • 做彩票网站怎么样软文什么意思
  • b2b网站运营推广普通话海报
  • 网络会议seo关键词排名报价
  • 山东济南网站开发河北优化seo