Post Content-Length Exceeds the Limit

POST Content-Length exceeds the limit

8388608 bytes is 8M, the default limit in PHP. Those changes to php.ini should indeed solve the problem (make sure your restart your Apache server after making them).

Memory limit shouldn't need to be changed here.

PHP Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

8388608 bytes is 8M, the default limit in PHP. Update your post_max_size in php.ini to a larger value.

upload_max_filesize sets the max file size that a user can upload while
post_max_size sets the maximum amount of data that can be sent via a POST in a form.

So you can set upload_max_filesize to 1 meg, which will mean that the biggest single file a user can upload is 1 megabyte, but they could upload 5 of them at once if the post_max_size was set to 5.

Changes will take effect after a restart of the server.

Unknown POST Content-Length exceeds limit

Update your value on the php.ini file from post_max_size=40 to a bigger value. 40m for example.

and restart your apache after the change is done.

POST Content-Length of 51110424 bytes exceeds the limit of 41943040 bytes in Unknown on line 0

The error message you are seeing is not really an error, but a warning. You should only see it in debug installations with display_errors enabled in php.ini.

In your code, you should test the 'error' field of the $_FILES object, and you should get the value UPLOAD_ERR_INI_SIZE (1) if the file size exceeds the maximum specified in php.ini.

See the documentation of error codes for further details.

PHP Warning: POST Content-Length exceeds the limit

You could do that in Javascript first so that even before the File could hit the Server, Javascript would alert/inform the User that the file Size is more than the Maximum Allowed Size. Here below is an example, which you may well test out and fiddle with first here.

    <html>
<head></head>
<body>
<input type="file" id="file_upload_1" name='file_upload_1' class="file_upload"/>
<!-- AND THEN, OTHER INPUT FORM FIELDS FOLLOW -->

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
(function($) {
$(document).ready(function(){
var fileInput = $("#file_upload_1");
var MaxAllowedSize = 2000; // 2KB
var sizeKMGB = "2KB";

fileInput.on("change", function(evt){
var objFile = $(this);
var fileSize = document.getElementById("file_upload_1").files[0].size;
console.log(fileSize);
if(fileSize > MaxAllowedSize){
// RESET THE UPLOAD TO NOTHING... SO USER CAN UPLOAD AGAIN...
var fSize = parseFloat(fileSize/1000).toFixed(2);
var sUnit = fSize + "KB";
if(fSize >= 100){
fSize = parseFloat( fileSize/(1000*1000)).toFixed(2);
sUnit = fSize + "MB";
}
objFile.val(null);
alert("Upload File-size Must not exceed " + sizeKMGB + ". \nYou tried to upload a File with about " + sUnit + ".")
}
});
});
})(jQuery);
</script>

</body>
</html>

PHP Warning: POST Content-Length of 113 bytes exceeds the limit of -1988100096 bytes in Unknown

On some 32bit systems PHP will take the memory settings like 2000M or 2G and convert it to the integer number of bytes by not performing a boundary check. A number starting at 2G or 2048M will be -2147483648 bytes then.

Some PHP versions cap this at the top, so it won't go into negative numbers (that is the 32 bit signed integer limit).

If you want to achieve the maximum possible number of bytes on such a system then, use 2147483647. This is equal to two gigabytes minus one byte.

Alternatively if you need to deal with large data, consider a 64bit system.

Additionally you should consider the following:

According to the PHP manual, the memory_limit setting is the more important one. If it does not offer enough memory, the post-data size-check then will pass, but PHP would not have enough memory to actually handle the post-data. You will get another error than, that the memory exceeded. So when you configure your PHP, take care that post_max_size is smaller than memory_limit.

In your example the memory_limit is 128M, so it can not process post-data of a size larger than ~128 Megabyte.

(This blog post shows what can happen and how large memory settings on 32bit and 64bit systems behave)



Related Topics



Leave a reply



Submit