Pasting an image from clipboard to a website

2019-02-03 18:58发布

问题:

I need to come up with a solution for users to be able to paste an image on to a website, then upload that image on to the web server. I'm not sure what the right solution for this - I am pretty sure javascript is out of the question because I don't think it can handle binary clipboard data (or any clipboard data?)

So, I'm not sure which way to go with this. Is this something possible with a Java applet? Or maybe a Flash SWF? Any other alternatives?

回答1:

Or this free one (via another StackOverflow question)



回答2:

You can use pure JavaScript for this, assuming either Chrome or Chrome Frame. Since most other plugins or applets require a specific install action you might as well require installing Chrome Frame as that will fix quite a bit more than just pasting events.

View a live demo of a jQuery plugin that cleanly wraps the HTML Clipboard API. This demo requires the Chrome browser.



回答3:

Rad Upload (java applet). It's not free, but it is relatively cheap.