Home > Article > Backend Development > How Can I Detect PHP\'s `post_max_size` Upload Errors?
Handling PHP Files Exceeding post_max_size
PHP provides two settings, upload_max_filesize and post_max_size, to limit file uploads. If a file exceeds upload_max_filesize, PHP returns its size as 0, while exceeding post_max_size results in a silent script failure.
Is there a way to catch the post_max_size error?
According to the documentation, post_max_size errors result in empty $_POST and $_FILES arrays. This can be detected by passing a $_GET variable to the processing script (e.g.,