vendredi 28 octobre 2016

How to fix Content-Length of * bytes exceeds the limit of * bytes

My problem is when I upload a file exceeds the limits I set in the script (5 MB) it shows this warning in the top of the website:

Warning: POST Content-Length of 32485176 bytes exceeds the limit of 20971520 bytes in Unknown on line 0

For example here I uploaded a file more than (30 MB) but when I upload a file more than (5 MB) and less than 30 (or not that large) it doesn't show that warning and shows only the error I wanted from the code :

if($file_size > 5000000) { echo
    "<div>
        You Can't Upload More than 5MB of the file
    </div>";
}

I am working on localhost and this error is appearing every time, I know how to fix it in localhost by modifying php.ini, but the website is online too and this error isn't showing in the website. Is there a way to limit the uploaded files sizes to (5 MB) and not modifying the php.ini file because I don't think I have the permission from the hosting company to change the apache config for the limits.

I hope my question's clear.

Thanks for helping.




Aucun commentaire:

Enregistrer un commentaire