We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
用户chooseMedia 选择视频类型的文件上传报错
The text was updated successfully, but these errors were encountered:
这里也遇到同样的问题了 经查发现问题出在参数类型上 wx.chooseMedia获取到的文件大小比如res.tempFiles[0].size 的 类型是String,这点和他文档描述的不一致 而wx.chooseVideo中获取到file.size的则是Number (所以使用chooseVideo的话就不会报错) 解决思路之一是手动将这个file的size值调整为Number类型
wx.chooseMedia
res.tempFiles[0].size
String
wx.chooseVideo
file.size
Number
wx.chooseMedia({ count: 1, mediaType: ['video'], sourceType: ['album', 'camera'], camera: 'back', success: function (res) { const file = res.tempFiles[0]; file.size = +file.size; // 将字符串强转为数字类型 // do sth with file }, })
起码在我的安卓机上可以成功上传
Sorry, something went wrong.
No branches or pull requests
用户chooseMedia 选择视频类型的文件上传报错
The text was updated successfully, but these errors were encountered: