Convert Data URI to File then append to FormData

后端 未结 14 2607
逝去的感伤
逝去的感伤 2020-11-21 07:14

I\'ve been trying to re-implement an HTML5 image uploader like the one on the Mozilla Hacks site, but that works with WebKit browsers. Part of the task is to extract an imag

14条回答
  •  感动是毒
    2020-11-21 07:18

    I had exactly the same problem as Ravinder Payal, and I've found the answer. Try this:

    var dataURL = canvas.toDataURL("image/jpeg");
    
    var name = "image.jpg";
    var parseFile = new Parse.File(name, {base64: dataURL.substring(23)});
    

提交回复
热议问题