Page({
button: function () {
wx.chooseMessageFile({
count: 10,
type: 'all',
success: function (res) {
var file = res.tempFiles[0];
wxfs.readFile({
filePath: file.path,
success: function (res) {
cos.putObject(
{
Bucket: 'examplebucket-1250000000',
Region: 'COS_REGION',
Key: file.name,
Body: res.data,
Headers: {
'Pic-Operations': '{"is_pic_info": 1, "rules": [{"fileid": "desample_photo.jpg", "rule": "watermark/3/type/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4uanBn"}]}',
},
},
(err, data) => {
console.log(err || data);
},
);
},
fail: (err) => console.error(err),
});
},
fail: (err) => console.error(err),
});
},
});
Was this page helpful?