blueimp-file-upload-expressjs icon indicating copy to clipboard operation
blueimp-file-upload-expressjs copied to clipboard

some AWS S3 problem

Open GinoToo opened this issue 10 years ago • 4 comments

Hi i am using this for my uploader, all will go the AWS S3 when i try it i have some problem

  1. when read the file form AWS the URL is not work the error is The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.

then i change the code in the index.js line 250 to url: (options.useSSL ? 'https:' : 'http:') + '//' + options.storage.aws.bucketName + '.s3-' + options.storage.aws.region + '.amazonaws.com/' + o.Key

them is can display correct, is that ok ?

  1. when post to aws that is no any thumbnail.

3.for the tmpDir the file will upload to it, those file will delete ?

thx Gino

GinoToo avatar Dec 29 '14 10:12 GinoToo

GinoToo,

  • Concerning thumbnails, they are currently only created if the options.storage.type is set to local. When set to aws, nothing is done
  • For the correct URL, I think the correct URL is //s3-{storage.aws.region}.amazonaws.com/{bucketName}/. Please confirm this, I only started to use S3 today to make some tests.

Thank you.

mycaule avatar Dec 29 '14 11:12 mycaule

Hello,

To answer your questions,

1 : This is same as https://github.com/arvindr21/blueimp-file-upload-expressjs/issues/16 the solution is set to the bucket name and point to region if you know. If not, leave the region out. Just in case, can you please post the config and options?

2 : As of now thumbnails are only supported in server uploads. I will need to implement this next.

3 : Looks like the delete logic is missing for AWS. Thanks for bringing it to the notice. Will fix this too.

-- Thanks.

arvindr21 avatar Dec 29 '14 11:12 arvindr21

I think the region is mandatory. I didn't have good results on a clean installation. I tried :

  • the default value region : 'us-west-2',
  • no region set at all (undefined).

In my case setting region:'eu-west-1' and changing the get URL here to this line below solved all the problems (GET and DELETE).

url: (options.useSSL ? 'https:' : 'http:') + '//s3-'+ options.storage.aws.region+'.amazonaws.com/' + options.storage.aws.bucketName + '/' + o.Key         

A simple way to know what the region is, is to go to your Amazon S3 Managment Console with your browser and to get the parameter value in the URL.

mycaule avatar Dec 29 '14 13:12 mycaule

hi arvindr21

reference for #16

http(s)://<bucket>.s3.amazonaws.com/<object>
http(s)://s3.amazonaws.com/<bucket>/<object>

for me also only work for the first one

http(s)://<bucket>.s3.amazonaws.com/<object>

no need to use the region

the code look like

url: (options.useSSL ? 'https:' : 'http:') + '//' + options.storage.aws.bucketName + '.s3.amazonaws.com/' + o.Key

here is my option

var options = {
    tmpDir:  __dirname + '/../assets/uploaded/tmp',
    uploadUrl:  '/uploaded/files/',
    maxPostSize: 11000000000, // 11 GB
    minFileSize:  1,
    maxFileSize:  10000000000, // 10 GB
    acceptFileTypes:  /.+/i,
    // Files not matched by this regular expression force a download dialog,
    // to prevent executing any scripts in the context of the service domain:
    inlineFileTypes:  /\.(gif|jpe?g|png)$/i,
    imageTypes:  /\.(gif|jpe?g|png)$/i,
    imageVersions: {
        width:  80,
        height: 80
    },
    accessControl: {
        allowOrigin: '*',
        allowMethods: 'OPTIONS, HEAD, GET, POST, PUT, DELETE',
        allowHeaders: 'Content-Type, Content-Range, Content-Disposition'
    },
    nodeStatic: {
        cache:  3600 // seconds to cache served files
    },
     storage : {
        type : 'aws',
         aws : {
            accessKeyId :  'XXXXXXXXXXXXXXXXXXXXXXXX',
            secretAccessKey : 'XXXXXXXXXXXXXXXXXXXXXXXX',
            bucketName : 'XXXXXXXXXXXXXXXXXXXXXXXX'
        }
    }
};

GinoToo avatar Dec 29 '14 14:12 GinoToo