0

How am I able to use a file retrieved from a user (for example, an image) using an input that looks like this? --> (<input type="file" id="fileInput">)

I've tried using var newFile = document.getElementById("fileInput.value); but that didn't work. I don't know if there is a Javascript feature that I am not aware of, but according to my research, there is not.

I only want to use HTML, Javascript, and CSS for my webpage, so please only include those languages in your response. Thank You!

Edison
  • 1
  • 1
  • https://stackoverflow.com/questions/15201071/how-to-get-full-path-of-selected-file-on-change-of-input-type-file-using-jav ? – PlayMa256 Apr 27 '18 at 22:22
  • 1
    I believe that this question is not a duplicate because I did not ask for the file path, I asked for the look of the user-provided image. – Edison Apr 27 '18 at 22:33
  • here's what you might be looking for: document.getElementById('fileInput').onchange = function () { alert('Selected file: ' + this.value); } NOTE this will not give you the path just the name of the file – DCR Apr 27 '18 at 22:48
  • 1
    That's close. What I wanted was to get the image that the user provides, and then add that image to my website. (I know that this will be temporary) But is there a way to that? – Edison Apr 30 '18 at 18:38

0 Answers0