How can I paste an image from the clipboard into a web form?

房东的猫 提交于 2019-12-04 13:34:16

问题


I found this question, but the question is about how to get an image from the clip board into a wyziwyg editor!

My question is "How can I paste an image from the clipboard into a field (what field is not that big issue as long as it works)", and then sent to the server.

Jira has this functionality, so it should be possible!

Any ideas on how to do this?

Just to explain the complete workflow; I would like to have a plave to multi upload images, where the paste from clipboard also is an option. The upload will be some ajax of some sort, bt is not important in this context!

Thanks


回答1:


UPDATED 25/11/2014

As Alistar say you can't do this with only javascript and html, but wait, is not so simple, depending on what you need you can try different way!

..clipboard method only works to put strings on the clipboard. For other types of data, such as URLs or images, you will need to use a more complex method...

HTML5

  • http://www.w3.org/TR/clipboard-apis/
  • http://www.w3.org/TR/clipboard-apis/#mandatory-data-types-1
  1. http://caniuse.com/#feat=clipboard
  2. https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent

Flex / Flash / ActionScript

  • Clipboard data formats
  • ActionScript 3.0 - Clipboard
  1. http://www.flexets.com/show-image-from-clipboard
  2. http://upog.wordpress.com/2010/02/14/copy-and-paste-in-flex-web-application/

JAVA

  • http://java.sun.com/j2se/1.5.0/docs/api/java/awt/datatransfer/Clipboard.html
  1. http://www.java2s.com/Code/Java/2D-Graphics-GUI/SendingImageObjectsthroughtheClipboard.htm
  2. http://lassebunk.dk/2009/08/04/clipboard-java-applet/
  3. http://www.devdaily.com/java/java-clipboard-image-copy-paste

ActiveX

Clipboard ActiveX for Image Copy/Paste into Web Forms



来源:https://stackoverflow.com/questions/2934520/how-can-i-paste-an-image-from-the-clipboard-into-a-web-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!