Pregunta

I have a strange issue with my website(using backbone.js,but i don't feel its something related to this framework). The template i am using is a bootstrap powered Admin theme called Ace Admin.

The HTML for file is as follows :

<input type="file" class="profileImage" name="profileImage" id="id-input-file-1" /> 

The Script associated for the same :

    $('#id-input-file-1').ace_file_input({
        no_file:'Image resolution 640*640',
        btn_choose:'Choose',
        btn_change:'Change',
        droppable:false,
        onchange:null,
        thumbnail:true,
        whitelist:'gif|png|jpg|jpeg',
        blacklist:'exe|php',
        //onchange:''
        //
    });        

In mozilla alone, that too in windows machine, when i click on the input the file selection screen appears twice. To be precise, when i click the input the local drive window opens up. I select a file and close it. As soon as i close it another window opens up. In effect i have to close two windows one after another if i click on file input.

So my question is :

  1. What am i doing wrong here?
  2. Can i handle this in someway? Like say i get the click event and register the status and handle the second call by checking with status or so?
  3. Is there a more obvious way of handling this through scripting?

My Input file :

enter image description here

The pop-up :

enter image description here

¿Fue útil?

Solución

After 1 long month, i found the solution. There was a min file with the template and inside that there was a code as follows specially for mozilla :

        if (b.browser.mozilla) {
            n.on("click", function () {
                if (!k.disabled && !m.attr("readonly")) {
                    m.click()
                }
            })
        }

When i removed this, it no longer triggers the file upload twice. I guess this was used for older versions of mozilla. There was lots of styles related to a single file button and the original file type was hidden from view.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top