Search code examples
javascriptphpajaxhtml2canvas

Error : Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)


I'm getting the following error.

Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)

function pageSS() {
    html2canvas(document.body, {
        onrendered: function (canvas) {
            var img = canvas.toDataURL();
            $.ajax({
                type: 'POST',
                url: 'https://myweb/upload_ss.php',
                data: img,
                processData: false,
                contentType: false
            }).done(function (data) {
                console.log(data);
            });
        }
    });
    return false;
}

What should I do?


Solution

  • A 413 Request Entity Too Large error occurs when a request made from a client is too large to be processed by the webserver. If your web server is setting a particular HTTP request size limit, clients may come across a 413 Request Entity Too Large response. An example request, that may cause this error would be if a client was trying to upload a large file to the server (e.g. a large media file).

    See this thread and configure your webserver to change the allowed upload limit.