Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

80
Vistas
How to display an image immediately after user selects it from their file explorer?

I am currently working on creating a form that takes in a .png file and stores it in a database. Is there a way to display the image on the frontend immediately after the user selects the .png from their file explorer without reloading the page or submitting the form? i.e., can the image be displayed immediately following selection without any backend interaction?

Boiling it down to the simplest components, I'm looking for something where the image is displayed in a div above the image input:

<div id="SelectedImage">Selected Image:</div>

<input id="pngFile" type="file" />

Thanks in advance.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Hello you can do it with jQuery, for example:

function img_pathUrl(input){
        $('#img')[0].src = (window.URL ? URL : webkitURL).createObjectURL(input.files[0]);
    }
#img {
  background: #ddd;
  width:100px;
  height: 90px;
  display: block;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<img id="img">
<br>
<input type="file" id="img_file" name="img_file" onChange="img_pathUrl(this);">

Adapt it to your needs.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda