Search code examples
javascriptasp.net-mvcxmlhttprequestgetusermedia

How post a large blob to server using XMLHttpRequest and asp.net MVC?


I am using your RecordRTC in mvc to record and post large size video. It works fine when I have 2-3 min recording but fails to post when I have around 8-10 min recording.I can see 404 controller action in this case.

var formData = new FormData(); 
formData.append(fileType + '-filename', fileName); 
formData.append(fileType + '-blob', blob); 
var request = new XMLHttpRequest(); 
request.open('POST', '/Admin/Videos/PostRecordedAudioVideo'); 
request.send(formData);

Solution

  • In your webconfig file add the below line into the <system.web> tag

    <httpRuntime targetFramework="4.5" executionTimeout="6000000" maxRequestLength="2147483647" />
    

    It will allow to upload large file size at the server. It just extend the limit 4MB to 2GB and it also extends the execution timeout. So if your file is large than it takes time to upload.

    You does not posted the code so, I assume that you can not added the above line of code into your webconfig.