How do I save a picture after Javascript-dataurl is uploaded to the server?

Source: Internet
Author: User
Using JS to cut the picture after the return of the Dataurl, how can be saved as a picture file?

Reply content:

Using JS to cut the picture after the return of the Dataurl, how can be saved as a picture file?

In fact, there is no need toDataURL , you can toBlob upload directly, you can also save a bit of traffic. Chrome isn't natively supported yet toBlob , but it's easy to find Polyfill. Firefox is already natively supported toBlob .

Of course, if and the data URL is uploaded to the server, take the content after the comma base64_decode is enough.

The general transmission is Base64, after the PHP, as the upstairs said, Base64 decode a bit.
Then simply and rudely said, file_put_contents a bit on the OK.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.