ファイルをs3にアップロードするプロジェクトに取り組んでいます。XMLHttpRequest を使用してポスト リクエストを s3 に送信すると、403 Forbidden ステータスが返されます。firebug で行ったリクエストを確認すると、「Request Method: OPTIONS」が表示され、POST リクエストであると想定されます。
以下は私のコードです:
function GetXmlHttpObject () {
     var xmlHttp = null;
     try {
       // Firefox, Opera 8.0+, Safari, IE 7+
       xmlHttp = new XMLHttpRequest();
     } catch (e) {
       // Internet Explorer - old IE - prior to version 7
       try {
          xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
       }
     }
     return xmlHttp;
    }
function uploadFile() {
    console.log(AWSAccessKeyId);
    var file = document.getElementById('file').files[0];
    var fd = new FormData();
    var key = "events/" + (new Date).getTime() + '-' + file.name;
    fd.append('key', key);
    fd.append('acl', 'public-read'); 
    fd.append('Content-Type', file.type);      
    fd.append('AWSAccessKeyId', AWSAccessKeyId);
    fd.append('policy', policyBase64)
    fd.append('signature', signature);
    fd.append("file",file);
    var xhr = GetXmlHttpObject();
    xhr.upload.addEventListener("progress", uploadProgress, false);
    xhr.addEventListener("load", uploadComplete, false);
    xhr.addEventListener("error", uploadFailed, false);
    xhr.addEventListener("abort", uploadCanceled, false);
    xhr.open('POST', 'https://'+bucket+'.s3.amazonaws.com/', true); //MUST BE LAST LINE BEFORE YOU SEND 
    xhr.setRequestHeader("Content-type","multipart/form-data");
    xhr.send(fd);
  }
私はここで立ち往生しています。T__T。