title: How to limit duration of the video with Dropzonejs?
body: <p>I have a form which I upload videos and duration/length of the video is important.</p>
  
  <p>After I upload the file with PHP, I check the duration of the video file size with <code>FFMpeg</code>.</p>
  
  <p>I calculate duration in PHP and need to send value of the duration via PHP somehow. I think I have to append the duration to <code>$result</code> variable of Json.</p>
  
  <p>This is my html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
  
          &lt;script src=
          "//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script src="https://rawgit.com/enyo/dropzone/master/dist/dropzone.js"&gt;&lt;/script&gt;
          &lt;link href="css/dropzone.css" rel="stylesheet"&gt;
          &lt;script type="text/javascript"&gt;
  
          Dropzone.options.myDropzone = {
  
          maxFiles: 1,
          acceptedFiles: "image/*,video/*",
          maxfilesexceeded: function (file) {
              this.removeAllFiles();
              this.addFile(file);
              $('#infomsg').hide();
  
          },
  
          init: function () {
              $('#infomsg').hide();
  
              this.on("success", function (result) {
  
                  $('#infomsg').show();
  
  
                  $("#boatAddForm").append($('&lt;input type="hidden" ' +
                      'name="files[]" ' +
                      'value="' + result.name + '"&gt;'));
  
              });
          }
          };
  
  
          &lt;/script&gt;
          &lt;title&gt;&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;p&gt;
              This is the most minimal example of Dropzone. The upload in this
              example doesn't work, because there is no actual server to handle
              the file upload.
          &lt;/p&gt;&lt;!-- Change /upload-target to your upload address --&gt;
          &lt;form action="/dropzone/upload.php" class="dropzone" id="my-dropzone"
          name="my-dropzone"&gt;&lt;/form&gt;
          &lt;form action="/dropzone/son.php" id="boatAddForm" method="post" name=
          "boatAddForm"&gt;
              &lt;input class="submit" type="submit"&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is my PHP</p>
  
  <pre><code>&lt;?php
  $ds          = DIRECTORY_SEPARATOR;
  
  $storeFolder = 'uploads';
  
  if (!empty($_FILES)) {
  
      $tempFile = $_FILES['file']['tmp_name'];
  
      $targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds;
  
      $targetFile =  $targetPath. $_FILES['file']['name'];
  
      move_uploaded_file($tempFile,$targetFile);
  
  } else {
      $result  = array();
  
      $files = scandir($storeFolder);                 //1
      if ( false!==$files ) {
          foreach ( $files as $file ) {
              if ( '.'!=$file &amp;&amp; '..'!=$file) {       //2
                  $obj['name'] = $file;
                  $obj['size'] = filesize($storeFolder.$ds.$file);
                  $result[] = $obj;
              }
          }
      }
  
      header('Content-type: text/json');              //3
      header('Content-type: application/json');
      echo json_encode($result);
  }
  </code></pre>
  
  <p>If I could check a custom json response right after  </p>
  
  <pre><code> Dropzone.options.myDropzone = {
  </code></pre>
  
  <p>like other requirements for success, I won't have to right if statements in success in order to check the validation. </p>
  
  <p>Basically I want to do it as I do like  </p>
  
  <pre><code> maxFiles: 1,
  </code></pre>
  
  <p>without writing any conditions inside <em>success</em></p>