Hello. I want to add the functionality to upload an image from the clipboard. I have tried something like this:
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
try {
BufferedImage image =
(BufferedImage)clipboard.getData(DataFlavor.imageFlavor);
}
catch(UnsupportedFlavorException ufe) {
ufe.printStackTrace();
}
catch(IOException ioe) {
ioe.printStackTrace();
}
However, this code only works in the local machine. I want to click a button and then, the clipboard’s image will be uploaded to the server.
Thank you.