input type file is Firing Twice onchange()
<p>I have this script </p>

<p><strong>Update:</strong></p>

<pre><code>/*on document ready*/
$(function() {
UploadFile();
}

function UploadFile(){
    $('#formarea').on('change', '.btn-file :file', function() {
        var input = $(this),
        numFiles = input.get(0).files ? input.get(0).files.length : 1,
        label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
        input.trigger('fileselect', [numFiles, label]);
        alert('test');/*this showing two time*/
    });
    $('#formarea').on('fileselect','.btn-file :file', function(event, numFiles, label) {
        var input = $(this).parents('.input-group').find(':text'),
        log = numFiles &gt; 1 ? numFiles + ' files selected' : label;
        if( input.length ) {
            input.val(log);
        } else {
            if( log ) alert(log);
        }
    });
}
</code></pre>

<p>and i have this field on the form:</p>

<pre><code>&lt;form id='formarea'&gt;
&lt;div class="form-group"&gt;
                                &lt;label class="col-lg-3 control-label"&gt;Documento Adjunto:&lt;/label&gt;
                                &lt;div class="col-lg-12 has-warning"&gt;
                                    &lt;div class="input-group"&gt;
                                        &lt;span class="input-group-btn"&gt;
                                            &lt;span class="btn btn-primary btn-file"&gt;
                                                buscar&amp;hellip; &lt;input id='file' type="file" name='i_file_1'&gt;
                                            &lt;/span&gt;
                                        &lt;/span&gt;
                                        &lt;input type="text" class="form-control" readonly&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;
                            &lt;/div&gt;
&lt;/form&gt;
</code></pre>

<p>The problem is that onchange is firing twice the <code>alert</code>/ <code>alert('test');</code>  / of javascript is showing two time.
I need the state on input filled with a file to start a filter file extention.</p>