在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ 微信小程序 canvas 生成的圖片 如何上傳到服務(wù)器?

微信小程序 canvas 生成的圖片 如何上傳到服務(wù)器?

大家好,
我現(xiàn)在有一個需求,就是在小程序中讓可以手動簽名,然后上傳到服務(wù)器。我用 canvas 實現(xiàn)了在屏幕上簽名,但是不會上傳到服務(wù)器
用微信提供的 wx.uploadFile 根本連網(wǎng)絡(luò)請求都不發(fā)

wx.canvasToTempFilePath({
    canvasId: 'myCanvas',
    success: function (res) {
        var path = res.tempFilePath;
        console.log(path)
    
        wx.uploadFile({
            url: 'http://localhost/e_contract/public/index.php/member/index/test',
            filePath: path,
            name: 'file',
            formData: {
                'user': 'test'
            },
            header: { "Content-Type": "multipart/form-data", 'Cookie': 'PHPSESSID=' + overall.json.token},
            success: function (res) {
                var data = res.data
                console.log(res);
                //do something
            },
            fail:function(res){

            }
        })
    }
})
回答
編輯回答
來守候

你沒有報錯嗎?

clipboard.png

你這里配置了嗎?

2017年6月26日 09:35
編輯回答
安于心

沒玩過小程序,但你用localhost?微信不知道你的localhost吧

2017年3月20日 02:35
編輯回答
離殤

解決了嗎 麻煩告知

2017年10月9日 12:54
編輯回答
離魂曲

解決了沒我也遇到了,如果解決了麻煩告知下 謝了 qq 2531947025

2017年1月15日 20:20