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

241
Vistas
How to add value before file input value on event oninput

I am trying to add text "img/books/" before the image file name in the file upload, to be concatenated and submitted this way the the db: "img/books/imageName.png", but this is not working :/

<script type="text/javascript">
   function addDir()
   {
        const imgDir = 'img/books/'
        document.getElementById('book_img').value =  imgDir +
        document.getElementById('book_img').file.value

   }
</script>

here is html code

<label for="fname">Book Image</label><br>
<input type="file" name="book_img" id="book_img" oninput="addDir()">
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It is not possible to change or set the value of the input file. This is for user safety reasons. However, it is possible to read the file name, associate it with the required address and save it in the input hidden. The backend must be prepared for this.

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