Search code examples
javascriptjqueryxmlhttprequest

XMLHttpRequest POST giving error for media files


I am using below code to post data with ajax

var oXHR = new XMLHttpRequest();
oXHR.upload.addEventListener('progress', uploadProgress, false);
oXHR.addEventListener('load', uploadFinish, false);
oXHR.addEventListener('error', uploadError, false);
oXHR.addEventListener('abort', uploadAbort, false);
oXHR.open('POST', 'client/uploadvideo');
oXHR.send(vFD);

It is sending txt files but for other like .mp4 file its not working


Solution

  • The issue was upload_max_filesize and post_max_size parameters, That required to be set on php.ini.

    The error was not mentioning above need to be modified, So at first not understood what was the issue.

    Answering this bcause might helpful to anybody