title: Insert csrf token for file upload
body: <p>How to insert csrf token in <a href="https://github.com/LPology/Simple-Ajax-Uploader" rel="nofollow">LPology/Simple-Ajax-Uploader</a>?</p>
  
  <p>I tried with <code>customHeaders</code> but without success.
  Although, <code>$("input[name='csrfmiddlewaretoken']").val()</code> gives <code>qEN1kNfYYkAasfqBn3AigICJmz4MIlei</code></p>
  
  <pre><code>var uploader = new ss.SimpleUpload({
          button: btn,
          url: 'file_upload/',
          name: 'uploadfile',
          customHeaders: {
            'X-CSRF-TOKEN': $("input[name='csrfmiddlewaretoken']").val()
          },
          multipart: true,
          hoverClass: 'hover',
          focusClass: 'focus',
          responseType: 'json',
          startXHR: function() {
              progressOuter.style.display = 'block'; // make progress bar visible
              this.setProgressBar( progressBar );
          },
          onSubmit: function() {
              msgBox.innerHTML = ''; // empty the message box
              btn.innerHTML = 'Uploading...'; // change button text to "Uploading..."
            },
          onComplete: function( filename, response ) {
              btn.innerHTML = 'Choose Another File';
              progressOuter.style.display = 'none'; // hide progress bar when upload is completed
              if ( !response ) {
                  msgBox.innerHTML = 'Unable to upload file';
                  return;
              }
              if ( response.success === true ) {
                  msgBox.innerHTML = '&lt;strong&gt;' + escapeTags( filename ) + '&lt;/strong&gt;' + ' successfully uploaded.';
              } else {
                  if ( response.msg )  {
                      msgBox.innerHTML = escapeTags( response.msg );
                  } else {
                      msgBox.innerHTML = 'An error occurred and the upload failed.';
                  }
              }
            },
          onError: function() {
              progressOuter.style.display = 'none';
              msgBox.innerHTML = 'Unable to upload file';
            }
      });
  };
  </code></pre>
  
  <p>Full example: <a href="https://github.com/LPology/Simple-Ajax-Uploader/tree/master/examples/basic_example" rel="nofollow">https://github.com/LPology/Simple-Ajax-Uploader/tree/master/examples/basic_example</a></p>
  
  <p>I use Django 1.9 on the backend instead. And my frontend form looks like:</p>
  
  <pre><code>&lt;form&gt;{% csrf_token %}
  ...
  &lt;/form&gt;
  </code></pre>
  
  <p>Dgango tag <code>{% csrf_token %}</code> produces <code>&lt;input type='hidden' name='csrfmiddlewaretoken' value='7CzH2kocMFDiGhSBlBY5OelS6oSND1Iw' /&gt;</code> for the page markup.</p>