title: How to gracefully handle files that exceed PHP's `post_max_size`?
body: <p>I'm working on a PHP form that attaches a file to an email, and trying to gracefully handle cases where the uploaded file is too large.</p>
  
  <p>I've learned that there are two settings in <code>php.ini</code> that affect the maxiumum size of a file upload: <code>upload_max_filesize</code> and <code>post_max_size</code>. </p>
  
  <p>If a file's size exceeds <code>upload_max_filesize</code>, PHP returns the file's size as 0. That's fine; I can check for that.</p>
  
  <p>But if it exceeds <code>post_max_size</code>, my script fails silently and goes back to the blank form.</p>
  
  <p><strong>Is there any way to catch this error?</strong></p>