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

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

我收到以下错误。

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;
}

我该怎么办?

当客户端发出的请求太大而无法被网络服务器处理时,会出现 413 Request Entity Too Large 错误。如果您的 Web 服务器设置了特定的 HTTP 请求大小限制,客户端可能会遇到 413 Request Entity Too Large 响应。一个可能导致此错误的示例请求是,如果客户端试图将大文件上传到服务器(例如,大媒体文件)。

查看此 thread 并配置您的网络服务器以更改允许的上传限制。