Save Canvas image (Post the data string to PHP)

后端 未结 1 700
鱼传尺愫
鱼传尺愫 2021-01-25 17:22

I\'m looking to learn Javascript and have been wanting to for a while, I got a little tutorial on how to create a HTML5 Canvas drawing application, I\'m trying to modify it so I

相关标签:
1条回答
  • 2021-01-25 17:56

    Use form, and send bytes by POST method:

    var form = document.createElement("form");
    form.setAttribute("action","http://localhost/save_server/");
    form.setAttribute("enctype","multipart/form-data");
    form.setAttribute("method","POST");
    form.setAttribute("target","_self");
    form.innerHTML = '<input type="hidden" name="image" value="'+strData+'"/>';
    form.submit();
    
    0 讨论(0)
提交回复
热议问题