title: Upload files not working using jQuery File Upload
body: <p><strong>Problem:</strong></p>
  
  <p>To set session variable and redirect user to different PHP-page once upload of .txt file has been completed using jQuery File Upload.</p>
  
  <p><strong>HTML code (upload.php):</strong></p>
  
  <pre><code>&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;Add 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;
  </code></pre>
  
  <p><strong>jQuery code (upload.php):</strong></p>
  
  <pre><code>&lt;script&gt;    
      $(function () {
          'use strict';
          // Server-side upload handler:
          var url = 'process.php';
  
          $('#fileupload').fileupload({
              url: url,
              autoUpload: true,
              acceptFileTypes: /(\.|\/)(txt)$/i,
              maxFileSize: 5000000, // 5 MB
              done: function (e, data) {
                  $(this).delay(2000, function(){
                      window.location = "explorer.php";
                  });
              },
              progressall: function (e, data) {
                  var progress = parseInt(data.loaded / data.total * 100, 10);
                  $('#progress .progress-bar').css(
                      'width',
                      progress + '%'
                  );
              }
          }).prop('disabled', !$.support.fileInput)
              .parent().addClass($.support.fileInput ? undefined : 'disabled');
      });
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>PHP upload script (process.php):</strong></p>
  
  <pre><code>&lt;?php
      session_start();
  
      $folder      = 'upload';
  
      if (!empty($_FILES))
      {
          // Set temporary name
          $tmp    = $_FILES['files']['tmp_name'];
  
          // Set target path and file name
          $target = $folder . '/' . $_FILES['files']['name'];
  
          // Upload file to target folder
          $status = move_uploaded_file($tmp, $target);
  
          if ($status)
          {
              // Set session with txtfile name
              $_SESSION['txtfile'] = $_FILES['files']['name'];
          }
      }
  ?&gt;
  </code></pre>
  
  <p><strong>Desired output:</strong></p>
  
  <ul>
  <li>Text file should be uploaded to folder /upload - which currently has chmod 777</li>
  <li>Session of text file name should be assigned to the variable $_SESSION['txtfile']</li>
  <li>Redirect user once upload is done to the file "explorer.php"</li>
  </ul>
  
  <p><strong>EDIT: SOLVED. Final code above!</strong></p>