Skip to content
This repository was archived by the owner on Nov 19, 2018. It is now read-only.
This repository was archived by the owner on Nov 19, 2018. It is now read-only.

File gets uploaded on s3 but signing failed in laravel controller #3

@pushpendraas400

Description

@pushpendraas400

Hi:
I am using fineuploader s3 server for laravel. I am using laravel 5.4. I have setup bucket, bucket policy, IAM User ,created group as suggested here:

https://blog.fineuploader.com/2013/08/16/fine-uploader-s3-upload-directly-to-amazon-s3-from-your-browser/

My bucket CORS settings look like:

<?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule> <AllowedOrigin>*</AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <AllowedMethod>POST</AllowedMethod> <AllowedMethod>PUT</AllowedMethod> <AllowedMethod>DELETE</AllowedMethod> <MaxAgeSeconds>3000</MaxAgeSeconds> <ExposeHeader>ETag</ExposeHeader> <AllowedHeader>*</AllowedHeader> <AllowedHeader>x-amz-acl</AllowedHeader> <AllowedHeader>x-amz-meta-qqfilename</AllowedHeader> <AllowedHeader>x-amz-date</AllowedHeader> </CORSRule> </CORSConfiguration>

Created a custom policy with following content

{
"Version":"2012-10-17",
"Statement":[{
"Effect":"Allow",
"Action":"s3:",
"Resource":"arn:aws:s3:::mybucketname/
"
}]
}

created a group called uploads-client and added policy and user to it.

use following javascript code:
` <script>
// Some options to pass to the uploader are discussed on the next page
var uploader = new qq.s3.FineUploader({
element: document.getElementById("uploader"),
debug:true,

objectProperties:{
'region':'us-east-1',
'bucket':'eauditions'

        },
        request: {
    endpoint: "eauditions.s3.amazonaws.com",
    accessKey: "AKIAIOTXKYEFLX6URQ5A"
},
signature: {
    endpoint: "{{url('api/endpoint_aws')}}",
    version:4,
},
 uploadSuccess: {
    endpoint: "{{url('api/endpoint_aws')}}?success",
    
},
cors: {
            expected: true
        },
validation: {
    allowedExtensions: ["gif", "jpeg", "jpg", "png"],
    acceptFiles: "image/gif, image/jpeg, image/png",
    sizeLimit: 500000,
    itemLimit: 1
},
        callbacks: {
            onComplete: function(id, name, response) {
                var previewLink = qq(this.getItemByFileId(id)).getByClass('preview-link')[0];

                if (response.success) {
                    console.log(response);
                  //  previewLink.setAttribute("href", response.tempLink)
                }
            },

             onError: function(id, name, errorReason, xhrOrXdr) {
        alert(qq.format("Error on file number {} - {}.  Reason: {}", id, name, errorReason));
    }


        }



    });
</script>`

I have also set the environment variables in .env file as stated here:

AWS_CLIENT_SECRET_KEY=BMnDU5NgT3urcTt33jv9ZWEa5RokI39NUEX0BTXS
AWS_SERVER_PUBLIC_KEY=AKIAIOTXKYEFLX6URQ5A

S3_BUCKET_NAME=eauditions
S3_HOST_NAME=http://eauditions.s3.amazonaws.com
S3_MAX_FILE_SIZE=500000
S3_BUCKET_REGION=us-east-1

S3_BUCKET_VERSION=2012-10-17

The issue is file gets uploaded to my bucket by fineuploader but laravel controller returns this JSON
{success: true, policy: "bnVsbA==", signature: "/etttCMJObj4YiHpBn0ke78LBns="}
it does not contain bucket name and key name or file name that gets uploaded.
Am i doing something silly here?
One more question
What is AWS_SERVER_PRIVATE_KEY HERE
is this IAM user secret key or .pem file key
What is AWS_SERVER_PUBLIC_KEY here
is this IAM user access key or .cert file key

please help me. I have been stuck here for past 2 days

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions