How to copy a file from OS file manager and paste it in an element of the browser?

I am using Macbook. I want to copy a file from a path (say Desktop) and I want to paste it in a text box in the browser. How could we achieve it? Also, how could we copy an image from google images and paste it into the text box?

Note: I want to paste the whole image and not the image path or the image URL.

I have usually utilized the Java robot class in order to to things like this but I don’t think it’s the most optimal way to do it…

Both of these imports are used so I can use the robot, and have it simulate keystrokes to navigate menus

import java.awt.Robot
import java.awt.event.KeyEvent

Oh great. I would like to try it. Will let you know if I was able to make it with Robots class

1 Like