jeudi 3 septembre 2015

Amazon S3 Invalid Argument Error Code

I am trying to upload a file image to my Amazon s3 bucket but keep getting a 400 Bad request error. On digging i found the error code is Invalid Argument but I dont know why i keep getting the error.

controller.js

 Upload.upload({
              url: url,
              method: 'POST',
              fields : {
                key: imageURI.name,
                AWSAccessKeyId: key,
                acl: 'public-read',
                policy: policy,
                signature: signature, 
                "Content-Type": imageURI.type != '' ? imageURI.type : 'application/octet-stream',
                filename: imageURI.name
              },
              file: imageURI,
            }).success(function(data, status, headers, config) {
                console.log(data);
                console.log(headers);
            }).error(function (data, status, headers, config) {

            });

cors configuration

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://ift.tt/1f8lKAh">
    <CORSRule>
        <AllowedOrigin>http://localhost:8100</AllowedOrigin>
        <AllowedOrigin>http://ift.tt/1Nc0U6T;
        <AllowedOrigin>http://ift.tt/1JAvgKj;
        <AllowedMethod>PUT</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

Any help is appreciated.

Thanks




Aucun commentaire:

Enregistrer un commentaire