0
I have an application that uploads video using XMLHttpRequest when I uploaded a small video (386Kb) the video goes up normal, but when I try a larger video (20Mb) it does not reach the function C# and returns error 500.
This is my Front End function :
document.getElementById('formItem').onsubmit = function (e) {
    var formdata = new FormData(); //FormData object
    //Creating an XMLHttpRequest and sending
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("load", transferComplete, false);
    xhr.addEventListener("error", transferFailed, false);
    xhr.open('POST', '/Unidade/Item/Cadastrar');
    if (xhr.upload) {
        xhr.upload.onprogress = function (e) {
            if (e.lengthComputable) {
                console.log(e.loaded);
                var value = Math.floor((e.loaded / e.total) * 100);
                progressBar.style.width = value + "%";
                progressBar.innerText = value + "%";
            }
        }
        xhr.upload.onloadstart = function (e) {
            progressBar.value = 0;
            display.innerText = '0%';
        }
        xhr.upload.onloadend = function (e) {
            var percentComplete = (e.loaded / e.total) * 100;
            $('#progressBar').css({ 'width': percentComplete + '%' });
            loadBtn.innerHTML = 'Iniciando o Upload';
        }
    }
    xhr.send(formdata);
    return false;
}
error returns when I call xhr.send(formdata);, the smaller video reaches the method normally but the biggest of the error, the two has the same extension (.mp4).
If any information is missing let me know.
video input :
 <video  controls poster="/Content/imagens/principais/Video-PlayButton.png" >' +
        <source src="' + e.target.result + '" type="video/mp4">
  </video>
						
How is the "function" on the server? What are you using on the server? Asp Classic, Webforms, Asp.NET MVC...
– Randrade
ASP.net Mvc, from the moment the code reaches the function Asp.Net Mvc, it saves correctly, if it needs to be put here.
– William Cézar
Post your file
Web.config– Randrade
What part you need from web.config??
– William Cézar
Oh I searched and found this <httpRuntime maxRequestLength="xxx" /> tag I just added to Web.config, I’m going to test.
– William Cézar
That would be my suggestion :p. Any doubt, exists this question which better explains its use
– Randrade
Thank you very much, this question has helped me a lot ...
– William Cézar