Trainee-Howto: Upload images from clipboard

This tutorials shows you how to implement a function to simply insert an image from your clipboard with "ctrl+v" or an image via drag&drop.

by Dennis Schaffer
Reading time 4 min
JOR Dennis Tutorial Teaser
Software Development
JOR Dennis Tutorial Teaser

Now I am already over 1 year in the apprenticeship as a software developer at Anexia. When I started here in March 2017, I could just create a simple page with HTML and CSS and I knew what Swift and Java was. Since that time I have been able to gain a lot of know-how. But most of all I use Javascript and PHP. Recently, however, I encountered a small problem. I should make a small change on the already existing Link-Shortener of Anexia, anx.io. This page is not only used to shorten a long link, you can also upload pictures from your PC to which a link is displayed after clicking on the upload button. If you use this link, the image you used will be displayed. I got the task that the user can use the function to simply insert an image from his clipboard with "stgr+v" or an image via drag&drop. To accomplish this, ZeroClipboard was used earlier, but for me this was out of the question, because I wanted to use a pure Javascript solution. Here I present you a small project with the source code to try it out for yourself.