upload picture to server from clipboard

后端 未结 2 2238
醉酒成梦
醉酒成梦 2021-02-20 17:10

I was looking a long time for the solution, but I can not find any. Is there any possibility to upload picture from clipboard to file on server (by pressing ctrl+v) ? It could w

2条回答
  •  天涯浪人
    2021-02-20 17:45

    You can try:

    https://github.com/layerssss/paste.js

    Or

    On paste event and clipboard API

    http://www.w3schools.com/jsref/event_onpaste.asp

    https://www.w3.org/TR/clipboard-apis/

    How does the paste image from clipboard functionality work in Gmail and Google Chrome 12+?

    After you get image in javascript you can send base64 encoded image to server with AJAX. At server-side, you can decode it and write to a file.

    Note: This works if you copy image inside browser (from other tab or window). It doesn't work when you copy image from desktop.

提交回复
热议问题