Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I want to cors upload my video file from browser to Amazon S3 storage via asp.net project. But I keep getting this error:the request signature we calculated does not match the signature you provided

Here is the javascript code I have;

JavaScript
function uploadFile() {

    var access_key = "xx";
    var secret = "xx";
    var policy = "xx";
    var signature = "xx";

    var file = document.getElementById('file').files[0];
    var fd = new FormData();

    var key = "folder1/" + (new Date).getTime() + '-' + file.name;

    fd.append('key', key);
    fd.append('acl', 'public-read-write');
    fd.append('Content-Type', file.type);
    fd.append('AWSAccessKeyId', access_key);
    fd.append('policy', policy)
    fd.append('signature', signature);

    fd.append("file", file);

    var xhr = new XMLHttpRequest();

    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://bucketName.s3.amazonaws.com/', true);

    xhr.send(fd);
}


What could be the reason for the error,
I'm sure accesskey,policy and signature is right.
Posted
Updated 15-May-15 5:18am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900