Jump to content

Seleccion multiple de imagenes en input file


jose.alonso

Recommended Posts

Hola!

 

Al crear un input file el prestashop me me añade el siguiente código a mayores (un div y dos spans):

<div class="uploader" id="uniform-j_file">
<input type="file" id="j_file" name="fileInteriorDesing[]" class="j_inputs j_file" multiple="true">
<span class="filename" style="-webkit-user-select: none;">No file selected</span>
<span class="action" style="-webkit-user-select: none;">Choose File</span>
</div>

Como puedo hacer para que en el span me aparezcan todas las imágenes seleccionadas??

aunque envía todas solo muestra el nombre una imagen.

 

Un saludo.

Link to comment
Share on other sites

Al final he dado con la solución y la voy a dejar aquí por si alguien tiene el mismo problema:

 

Al input file le he añadido:   onChange="return miFuncion()"

 

 

y en el archivo de javascript he creado la funcion con el siguiente contenido:

function miFuncion(){
    var files = document.getElementById("j_file").files;
    var nombre;
    for (var i = 0; i < files.length; i++){
        nombre+=files[i].name+"; ";
    }

    nombre=nombre.substring(9, nombre.length);
    setTimeout(function(){ $(".filename").text(nombre); }, 500);
}

Espero que ha alguien le sirva de ayuda.

 

Un saludo.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...