So there is this code
<div>DROP!<button onclick="document.querySelector('input').click()">Or click</button> </div>
<input style="visibility: collapse; width: 0px;" type="file" onchange="upload(this.files[0])">
<script>
window.ondragover = function(e) {e.preventDefault()}
window.ondrop = function(e) {e.preventDefault(); upload(e.dataTransfer.files[0]); }
function upload(file) {
if (!file || !file.type.match(/image.*/)) return;
And what it does is take a file from the user, checks if it's an image and then does something. How can I make it so that instead of letting the user select the image I select the path of the image and then it does what it's supposed to do. So like declare the file I think.