How Attach a image to input file javascript

Viewed 34

I want to attach photo that I have saved in the files but I want to attach them to input file

<script>
document.getElementById("imageUpload").src = "./test_images/1.png";
</script>

<input type="file" id="imageUpload">
1 Answers

Maybe you could set the "value" property to a variable you are first initializing with the image you want to display. If a user selects another image for the input, you would have to update this variable.

Related