0
I have a browser problem only in IE9, which occurs at the time I load an attachment and when I click the include attachment button (POST)
as image below:

function uploadResponse(frameId) {
    $.ajax({
        type: "POST",
        url: "/Turma/AtualizarGridAnexo",
        success: function (data) {
            $("#divGridAnexo").html(data);//Fill div with results
        },
        error: function (xhr, ajaxOptions, thrownError) {
            alert(xhr);
            alert(ajaxOptions);
            alert(thrownError);
        }
    });
}
$("#adicionarAnexo").click(function (e) {
    var fileInput = $('#idAnexo');
    var maxSize = 5000000; //colocar valor em bytes
    var fname = $('#idAnexo[type=file]');
    console.log(fileInput.get(0).files[0].size);
    //pega o tamanho do arquivo
    if (fileInput.get(0).files.length) {
        var fileSize = fileInput.get(0).files[0].size;
        //verifica se é maior que 5MB
        if (fileSize > maxSize) {
            alert('Este arquivo é muito grande para ser anexado. Limite máximo permitido: 5MB.');
            return false;
        }
        //verifica se a extensão do arquivo é permitida
        var fileName = $('input[type=file]').val().toUpperCase();
        var regex = new RegExp("(.*?)\.(PDF|XLS|XLSX|DOC|DOCX|PPT|PPTX|MP3|WMA|AVI|PNG|JPG)$");
        if (!(regex.test(fileName))) {
            $('input[type=file]').val('');
            alert('Extensão não permitida, as extensões permitidas são: PDF, XLS, XLSX, DOC, DOCX, PPT, PPTX, MP3, WMA, AVI, PNG e JPG');
            return false;
        }
        //se o tamanho e a extensão for correta, faz upload do arquivo
        else {
           var tempFrame = document.createElement("iframe");
           tempFrame.src = "";
           tempFrame.onload = uploadResponse.bind(this, tempFrame);
           tempFrame.name = "tmpFrameUpload"
           this.appendChild(tempFrame);
           this.form.target = tempFrame.name;
           this.form.name = "uploadForm";
           this.form.acceptCharset = "UTF-8";
           //This is an example of a hidden input, used to pass extra vars to the server. Add more if you need them.
           //var tempNodePath = document.createElement("input");
           //tempNodePath.type = "hidden";
           //tempNodePath.value = [dir]; //if you want specify a target path.
           //tempNodePath.name = "filePath";
           //this.form.insertBefore(tempNodePath, this.form.childNodes[0]);
           this.form.submit();
           jq.idAnexo.val('');
        }
    } else {
        return false;
    }
});
The error occurs in the console log.(fileInput.get(0). files[0]. size);
Could someone help me? I’ve searched here but found nothing like it...
From now on I thank you guys!!

You are trying to access an Index in files before checking if there is a file, try to move the
console.log(fileInput.get(0).files[0].size);into the blockif (fileInput.get(0).files.length) { ... }– Tobias Mesquita
@Tobymosque He’s already there, but no console log..
– Guilherme Lautert
@Mariane, you debug through the console and checked the data of each variable?
– Guilherme Lautert
@Guilhermelautert already yes, I just did that and I saw that it is my input[type=file]'). which is not supported by the IE9 browser. But I don’t know how to change this, what to put in place of input[type=file]').
– Mariane Ribeiro
@Guilhermelautert I edited the question by adding more console debug information...
– Mariane Ribeiro