普通网友 2015-08-08 08:00
浏览 11

从画布上传图像

Some one please help me, This is the first time i am using canvas in html,and the question is, is there any way to pass the image from canvas into server using multipart file upload in form submission ....

  • 写回答

1条回答 默认 最新

  • weixin_33682790 2015-08-08 08:12
    关注

    yes you can upload your canvas with canvas.toDataURL('image/jpeg') and ajax

    $.post('/upload',
    {
        uid : uid,
        img : canvas.toDataURL('image/jpeg')
    },
    function(data) {});
    

    for multi-part upload visit this question

    JavaScript Blob Upload with FormData

    and its easy way for convert canvas to blob

    https://blueimp.github.io/JavaScript-Canvas-to-Blob/test/

    评论

报告相同问题?