title: Dropzone.js upload with PHP failed after 30 seconds upload
body: <p>I'm trying to upload "large" files to my application. Users must be able to upload video files smallest than 200MB but seem the server drops the connections after 4MB or 30 seconds and the upload fails.</p>
  
  <p>I've already set all the parameters in my <code>php.ini</code>file as this:</p>
  
  <p><code>max_input_time  = 320</code><br>
  <code>max_execution_time = 320</code><br>
  <code>max_file_uploads = 20</code><br>
  <code>memory_limit = 512M</code><br>
  <code>post_max_size = 201M</code><br>
  <code>upload_max_filesize = 200M</code><br></p>
  
  <p>Everything is working when I upload a file of 2MB @ 1Mbps/s (I don't know if is a problem relating to filesize or transfer time)</p>
  
  <p>Live php_info() file can be reached at php_info</p>
  
  <p>Although here is DropZone.js conf:</p>
  
  <pre><code>$("#dZUpload").dropzone({
       url: "/ajax/admin/admin.acceptVideo.php",
       maxFilesize: 209715200,
       acceptedFiles: "video/*",
       addRemoveLinks: true,
       dataType: "HTML",
       data: { id: '' },
       success: function (file, response, data) {
           var imgName = response;
           file.previewElement.classList.add("dz-success");
           $('#form_video').val(imgName);
       },
       error: function (file, response) {
       file.previewElement.classList.add("dz-error");
       }
  });
  Dropzone.autoDiscover = false;
  Dropzone.prototype.defaultOptions.dictRemoveFile = "Rimuovi file";
  Dropzone.prototype.defaultOptions.dictCancelUpload = "Annulla";
  </code></pre>
  
  <p>And here is the PHP script that handles uploads:</p>
  
  <pre><code>&lt;?php
  require_once '../db.config.php';
  
  header('Content-Type: text/plain; charset=utf-8');
  
  ini_set('upload_max_filesize', '200M');
  ini_set('post_max_size', '201M');
  ini_set('max_input_time', 320);
  ini_set('memory_limit', '256M'); 
  
  
  try {
      if (
          !isset($_FILES['file']['error']) ||
          is_array($_FILES['file']['error'])
      ) {
          throw new RuntimeException('Invalid parameters.');
      }
  
      switch ($_FILES['file']['error']) {
      case UPLOAD_ERR_OK:
          break;
      case UPLOAD_ERR_NO_FILE:
          throw new RuntimeException('No file sent.');
          break;
      case UPLOAD_ERR_INI_SIZE:
          break;
      case UPLOAD_ERR_FORM_SIZE:
          throw new RuntimeException('Exceeded filesize limit.');
          break;
      default:
          throw new RuntimeException('Unknown errors.');
          break;
  }
  
      // check filesize. 
      if ($_FILES['file']['size'] &gt; 209715200) {
          throw new RuntimeException('Exceeded filesize limit.');
      }
  
      // Check MIME Type.
      $finfo = new finfo(FILEINFO_MIME_TYPE);
      if (false === $ext = array_search(
              $finfo-&gt;file($_FILES['file']['tmp_name']),
              array(
                  'mp4' =&gt; 'video/mp4',
                  'mov' =&gt; 'video/mov',
                  'avi' =&gt; 'video/avi',
              ),
              true
          )) {
          throw new RuntimeException('Invalid file format.');
      }
  
      // name uniquely.
      $fileName = sha1_file($_FILES['file']['tmp_name']);
      if (!move_uploaded_file($_FILES['file']['tmp_name'], sprintf('/var/www/html/beta.vedocompro.it/web/webtemp/%s.%s', $fileName, $ext ))) {
          throw new RuntimeException('Failed to move uploaded file.');
      }
  
      try {
  
          $PDO = new PDO('mysql:host=' . $DB_HOST . ';dbname=' . $DB_NAME,$DB_USER,$DB_PASS);
          $insert = $PDO-&gt;prepare("INSERT INTO `videos` (`id`, `aid`, `accepted`, `uid`, `dir`) VALUES (NULL, '0', '0', '0', $fileName);");
          $insert-&gt;execute();
  
          echo $fileName;
  
      } catch(PDOException $exception) {
          echo $exception;
      }
  
  
  
  } catch (RuntimeException $e) {
  
      echo $e-&gt;getMessage();
  
  }
  </code></pre>
  
  <p>So everything seems to be ok but server drop the connection after something wrong (I don't think is related to <code>PDO</code>query cause a smaller file of 2MB will work).</p>
  
  <p>Could you please help identify the problem?</p>
  
  <p><strong>EDIT</strong> Doing some tests i've found that the script drop exactly at 30 second of execution, i've tryed to add <code>set_time_limit(0);</code> in top of the script but nothing changed again</p>