I am trying to write a File Upload module in Codeigniter 3.1.11. Maximum file size has been set at 20Mb with
$config['max_size'] = 20480;
PHP upload limit is 40Mb.
But, when I run it and try to upload a heavy file, it does not redirect properly and loads the same form with
<br />
<b>Warning</b>: POST Content-Length of 368347418 bytes exceeds the limit of 41943040 bytes in <b>Unknown</b> on line <b>0</b><br />
<!DOCTYPE html>
<html lang="en" class="h-100">
at the begining of the Html code.
I believe this is because the php size limit gets tripped first before the codeigniter limit can work and redirect properly. How do I solve this?
P.S.:
- I do not want to upload that file. I want that error. But I want to catch the error properly and redirect to some other page, instead of it getting posted over html. I have written that part of the code in Codeigniter, but this error is thrown before that portion of the code executes I believe.
- This error does not occur when the file size is higher than Codeigniter limit but less than PHP limit. Then the error is caught properly by Codeigniter and redirection code works perfect.