title: How to correct content-disposition error
body: <p>Thanks always for your support. I am currently trying to upload media through ajax/jquery. I could upload image, but anytime i tried to upload video, i was formerly getting no content-disposition supplied. so i added this:</p>
  
  <pre><code>xhr.setRequestHeader("content-Disposition", "attachment; filename=small.mp4");
  </code></pre>
  
  <p>and what i get now is header preflight issue:</p>
  
  <p>Failed to load <a href="http://myurl/wp-json/wp/v2/media" rel="nofollow noreferrer">http://myurl/wp-json/wp/v2/media</a>: Request header field content-Disposition is not allowed by Access-Control-Allow-Headers in preflight response.</p>
  
  <p>this is my wordpress:</p>
  
  <pre><code># BEGIN WordPress
  &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  &lt;/IfModule&gt;
  
  &lt;IfModule mod_headers.c&gt;
    &lt;FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js|mp4)$"&gt;
  Header set Access-Control-Allow-Origin "*"
  Header set Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Content-Disposition, Accept"
  
  &lt;/FilesMatch&gt;
  &lt;/IfModule&gt;
  
  # END WordPress
  </code></pre>
  
  <p>my request code is as thus:</p>
  
  <pre><code>$.ajax({
          url: 'http://myurl/wp-json/wp/v2/media',
          method: 'POST',
          data: formData,
          crossDomain: true,
          contentType: 'application/json',
          contentType: false,
  
          contentDisposition: 'form-data',//'attachment, filename="small.mp4"',
          //contentDisposition: 'attachment, filename="small.mp4"'
          processData: false,
  
          beforeSend: function (xhr) {
              xhr.setRequestHeader( 'Authorization', 'Basic ' + Base64.encode( 'admin:Rastrastvibe' ) );
              xhr.setRequestHeader("content-Disposition", "attachment; filename=small.mp4");
  
          },
          success: function( data ) {
              console.log( data );
              var featuredimageid = data.id;
              formData.append("featured_media", featuredimageid);
  
  
              $.ajax({
                  url: 'http://myurl/wp-json/wp/v2/posts',
                  method: 'POST',
                  data: formData,
                  crossDomain: true,
                  contentType: 'application/json',
                  contentType: false,
                  processData: false,
                  beforeSend: function (xhr) {
                      xhr.setRequestHeader( 'Authorization', 'Basic ' + Base64.encode( 'admin:pass' ) );
                  },
                  success: function( data ) {
  
                      console.log( data );
             // var featuredimage= data.id;
             // console.log(featuredimage);
  
  
  
         },
         error: function( error ) {
          console.log( error );
  
      }
  });
  
  
          },
          error: function( error ) {
              console.log( error );
  
  
          }
      });
  });
  </code></pre>