title: How to read image file using plain javascript?
body: <p>I am new to javascript and I am currently having problem with one of my projects which includes viewing of an image from the root folder of the website. Here is my current code:  </p>
  
  <pre><code>var reader = new FileReader();
  
      reader.onload = function(event){
             var dataUri = event.target.result,
                 img = document.createElement("img");
  
                 img.src =  dataUri;
                 document.body.appendChild(img);
      };
  
      reader.onerror = function(event){
             console.log("File could not be read: " + event.target.error.code);
      };
  
  reader.readAsDataURL("/uploads/extras/item_a/image1.png");
  </code></pre>
  
  <p>That's my code and it doesnt show anything. And in my console it gives me an error or <code>Uncaught TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'.
  </code></p>