1
得到這個工作,我不知道是否是最好的方法:filepicker.io - 畫布保存爲PNG
// Take off the "data:image/png;base64," prefix
var b64 = canvas.toDataURL().split(',', 2)[1];
filepicker.store(
b64,
{
mimetype: 'image/png',
base64decode: true
}
...
我會補充說。 思想:如果你接受了完整的data:URL,那麼我們就不需要了'MIME類型:「圖像/ PNG」,base64decode:TRUE' – forresto
想這可能節省一些帶寬與'window.atob發送二進制數據( canvas.toDataURL()。split(',',2)[1])'和'base64decode:false'。它返回OK,但是[損壞](https://www.filepicker.io/api/file/BFsTLioTAS3lmuSUigu3)。 – forresto