Javascript-could you tell me how to use PHP + JS to paste an image in the input box and upload it to the server?

Source: Internet
Author: User
Paste the image in the input box and upload it to the server. How can this problem be achieved using PHP? (This is not the way to upload local files, but from the clipboard) paste an image in the input box and upload it to the server. How can this problem be achieved using PHP? (This is not the way to upload local files, but from the clipboard)

Reply content:

Paste the image in the input box and upload it to the server. How can this problem be achieved using PHP? (This is not the way to upload local files, but from the clipboard)

Does this require the File API function in HTML5? IE8 is not supported in most cases:

Document. onpaste = function (event) {var items = event. clipboardData. items; for (index in items) {var item = items [index]; if (item. kind = 'file') {var blob = item. getAsFile (); var reader = new FileReader (); reader. onload = function (evt) {console.log(evt.tar get. result)}; reader. readAsDataURL (blob );}}

However !!!! Do not mistakenly think that you can directly copyAn Image FilePaste the image file and press the PrntScr key or copy the image content in windows !!!

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.