Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

221
Views
Javascript Image Upload [File Not Found]

I am trying to implement image upload to a project but Chrome inspector says that the file cannot be found. The HTML seems okay. Not too sure about the CSS and Javascript. Is this some sort of security measure/firewall issue? I'm using a Mac if that helps.

const image_input = document.querySelector("#image_input");
var uploaded_image = "";

image_input.addEventListener("change", function() {
  const reader = new FileReader();
  reader.addEventListener("load", () => {
    uploaded_image = reader.result;
    document.querySelector("#display_image").style.backgroundImage = 'url(${uploaded_image})'
  });
  reader.readAsDataURL(this.files[0]);
})
body {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-direction: column;
  height: 100vh;
}

#display_image {
  width: 375px;
  height: 211px;
  border: 1px solid black;
  background-position: center;
  background-size: cover;
}
<input type="file" id="image_input" accepts="image/png, image/jpg">
<div id="display_image"></div>

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!