title: Laravel 3 - POST Content-Length Exception
body: <p>Running Laravel 3. </p>
  
  <p>I am trying to upload files with the laravel framework. If the file is larger than the php setting for <code>upload_max_filesize</code> it throws the exception below.</p>
  
  <p>I have tried this in my controller and routes with no success (the <code>if</code> statement runs - it sets a session - but the exception is still thrown showing the error page)</p>
  
  <pre><code>if ($_SERVER['CONTENT_LENGTH'] &gt; 8380000) {
      //do stuff here because its too big
      // set a session and exit()
  }
  </code></pre>
  
  <p><strong>How can I prevent this exception from being thrown without upping the php memory limits?</strong></p>
  
  <p>Error:</p>
  
  <pre><code>Unhandled Exception
  
  Message:
  
  POST Content-Length of 9306598 bytes exceeds the limit of 8388608 bytes
  Location:
  
  Unknown on line 0
  </code></pre>
  
  <p>As a side note, this question has been asked atleast twice in the laravel forum with no good answer given except for 'increase your php memory limits'.</p>
  
  <p><strong>EDIT</strong>: the problem seems to be that laravel is loading all the <code>_POST</code> inputs before I can even check them in the route or controllers. Seems like a bug to me.</p>