title: Nginx: referring too-large files uploads to application?
body: <p>I need to be able to deal with uploaded files sizes exceeding the maximum nginx and php limits before nginx issues an error 413 page. Instead, I want to issue an error message within my application (symfony) dialog.</p>
  
  <p>To test the file-size limits in symfony, My test upload file is 600 Mb. When I upload the 600 Mb file under nginx, the upload runs to 100%, then 
  reports "<em>413 Request Entity Too Large</em>".</p>
  
  <p>If I run "app/console server:run" (which uses the symfony server instead of nginx), symfony reports the error in the gui before the upload occurs (as intended).</p>
  
  <p>Is there any way to modify the nginx configuration so it reads the $_SERVER[CONTENT_LENGTH] or $_SERVER[HTTP_CONTENT_LENGTH], aborts the upload, and then passes the rejected request to the app? Symfony flags the error depending on CONTENT_LENGTH (and, with a work-around for a symfony issue, HTTP_CONTENT_LENGTH).</p>
  
  <p>File size limits:</p>
  
  <pre><code>src/my_app/CoreBundle/Resources/config/validation.yml: maxSize: '500M'
  /etc/php5/cgi/php.ini:post_max_size = 550M
  /etc/php5/cgi/php.ini:upload_max_filesize = 500M
  /etc/php5/cli/php.ini:post_max_size = 550M
  /etc/php5/cli/php.ini:upload_max_filesize = 500M
  /etc/php5/fpm/php.ini:post_max_size = 550M
  /etc/php5/fpm/php.ini:upload_max_filesize = 500M
  </code></pre>
  
  <p>Versions:</p>
  
  <pre><code>symfony 2.5.12  
  nginx 1.4.6-1ubuntu3.4
  </code></pre>