title: Blueimp file upload plugin, progress bar completes before file is uploaded
body: <p>I'm using this plugin to upload files:
  <a href="https://github.com/hashmode/cakephp-jquery-file-upload" rel="nofollow noreferrer">https://github.com/hashmode/cakephp-jquery-file-upload</a></p>
  
  <p>The upload works, but the progress bar always completes before the file is uploaded. Prior to using this plugin, I attempted to use the blueimp uploader standalone. I had the same problem.</p>
  
  <p>Any idea how to make the progress bar work properly?</p>
  
  <p>I'm testing this via a proxy. I can see the proxy is still awaiting the response. Yet the progress bar is 100%.</p>
  
  <p>This is the code I'm using in my view:</p>
  
  <pre><code>&lt;?php echo $this-&gt;JqueryFileUpload-&gt;loadCss(); ?&gt;
  &lt;?php echo $this-&gt;JqueryFileUpload-&gt;loadScripts(); ?&gt;
  
  &lt;div class="row"&gt;
      &lt;div class="col-md-12"&gt;
          &lt;div class="card "&gt;
              &lt;div class="header"&gt;
                  &lt;h4 class="title"&gt;Import Session Data&lt;/h4&gt;
                  &lt;p class="category"&gt;category text&lt;/p&gt;
              &lt;/div&gt;
              &lt;div class="content"&gt;
                  &lt;!-- The fileinput-button span is used to style the file input field as button --&gt;
                  &lt;span class="btn btn-success fileinput-button"&gt;
                      &lt;i class="glyphicon glyphicon-plus"&gt;&lt;/i&gt;
                      &lt;span&gt;Select files...&lt;/span&gt;
                      &lt;!-- The file input field used as target for the file upload widget --&gt;
                      &lt;input id="fileupload" type="file" name="files[]" multiple&gt;
                  &lt;/span&gt;
                  &lt;br&gt;
                  &lt;br&gt;
                  &lt;!-- The global progress bar --&gt;
                  &lt;div id="progress" class="progress"&gt;
                      &lt;div class="progress-bar progress-bar-success"&gt;&lt;/div&gt;
                  &lt;/div&gt;
                  &lt;!-- The container for the uploaded files --&gt;
                  &lt;div id="files" class="files"&gt;&lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="footer"&gt;
                  &lt;hr&gt;
                  &lt;div class="stats"&gt;
                      &lt;i class="fa fa-history"&gt;&lt;/i&gt; footer
                  &lt;/div&gt;
              &lt;/div&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;script&gt;
  /*jslint unparam: true */
  /*global window, $ */
  $(function () {
      'use strict';
      // Change this to the location of your server-side upload handler:
      var url = '/sessions/import';
      $('#fileupload').fileupload({
          url: url,
          dataType: 'json',
          done: function (e, data) {
              $.each(data.result.files, function (index, file) {
                  $('&lt;p/&gt;').text(file.name).appendTo('#files');
              });
          },
          progressall: function (e, data) {
              var progress = parseInt(data.loaded / data.total * 100, 10);
              $('#progress .progress-bar').css(
                  'width',
                  progress + '%'
              );
          },
          success: function(response) {
              var json = $.parseJSON(response);
              alert(json['message']);
          }
      }).prop('disabled', !$.support.fileInput)
          .parent().addClass($.support.fileInput ? undefined : 'disabled');
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>In my controller I have:</p>
  
  <pre><code>public function import() 
  {
      if ($this-&gt;request-&gt;is('post')) {
          $options = array(
              'max_file_size' =&gt; 2048000,
              'max_number_of_files' =&gt; 10,
              'access_control_allow_methods' =&gt; array(
                  'POST'
              ),
              'accept_file_types' =&gt; '/\.(png|jpg)$/i',
              'upload_dir' =&gt;  '../uploads/workbench/', //WWW_ROOT . 'files' . DS . 'uploads' . DS,
              'upload_url' =&gt; '/files/uploads/',
              'print_response' =&gt; false
          );
  
          $result = $this-&gt;JqueryFileUpload-&gt;upload($options);
  
          print_r($result);
          die();
      }
  }
  </code></pre>