微信小程序:拍照上傳,安卓正常,蘋果報錯


問題描述

同樣是使用 camera組件拍照,然后使用wx.uploadFile()上傳服務器識別。

安卓手機工作正常,蘋果手機上傳圖片后,服務器拋回異常500.

 

解決方案

camera的尺寸設置偏小,略微調整camera的height屬性后,問題解決。

本次調節具體值為:600rpx存在問題,700rpx解決問題。

通過iPhone6測試。

<camera device-position="back" flash="off" binderror="error" style="width:100%;height:700rpx;" />
 
takePhoto() {
var that = this;
const ctx = wx.createCameraContext();
ctx.takePhoto({
quality: 'normal', //'low',//'high',
success: (res) => {
console.log(res.tempImagePath);
。。。。
wx.uploadFile({
url: 'http://xxxxxxx',
filePath: res.tempImagePath,
name: 'file',
。。。

另外,quality: 'normal'替換為'high' 無法解決上述問題。

 

問題原因

猜測:蘋果生成的文件大小過小,服務器不識別。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM