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

547
Vistas
Is it possible for another element to act as a proxy for a file input in a web form?

I want to be able to drag a file onto any HTML Element and have it behave as if it was dragged onto a file input.

I can sort of do it with something like this:

<label>
    <input type="file">
</label>

… and use CSS to increase the label and hide the file input:

label {
    display: block;
    width: 200px;
    height: 100px;
}
input[type="file"] {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    opacity: 0;
}

but that isn’t very flexible.

I have tried using using a different element, which I would prefer, and JavaScript’s drop event and the eventTransfer object. I can get the file data, but can’t add it to the file input.

Other solutions tend to us Ajax and send the file directly or to some sort of holding area, but I would like to know whether it is possible to do simply with the file input.

about 4 years ago · Juan Pablo Isaza
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