Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

using multer -s3 amazon server image upload error access denied

// or use my trick like this
let acl = 'ACL'

// like this not my trick
var upload = multer({
    storage: multerS3({
        s3: s3,
        ACL: 'public-read',
        bucket: BucketName,
        key: function (req, file, cb) {
            cb(null, new Date().toISOString() + '-' + file.originalname);
        }
    })
});

// like this with my trick for by error in ts
var upload = multer({
    storage: multerS3({
        s3: s3,
        [acl]: 'public-read',
        bucket: BucketName,
        key: function (req, file, cb) {
            cb(null, new Date().toISOString() + '-' + file.originalname);
        }
    })
});
Comment

multer s3 access denied

	static awsStorage: multer.StorageEngine = multerS3({
		s3: new aws.S3({
			credentials: new aws.Credentials({
				accessKeyId: process.env.AWS_ACCESS_KEY_ID,
				secretAccessKey: process.env.AWS_ACCESS_KEY
			}),
			hostPrefixEnabled: true,
			computeChecksums: true,
			s3BucketEndpoint: true,
			correctClockSkew: true
		}),
		bucket: process.env.AWS_BUCKET_NAME,
		contentType: multerS3.AUTO_CONTENT_TYPE,
		serverSideEncryption: 'AES256',
		[Multer.acl as any]: 'public-read',
		metadata(_req: Request, file: Express.Multer.File, done: any) {
			if (!file) done(new Error('Get file upload failed'), null)
			done(null, file)
		},
		key(_req: Request, file: Express.Multer.File, done: any) {
			done(null, `${Date.now()}.${file.originalname.split('.')[1]}`)
		}
	})
Comment

PREVIOUS NEXT
Code Example
Typescript :: delphi call function from its name 
Typescript :: expected assets to be a list in flutter 
Typescript :: how to set up vuex with typescript 
Typescript :: multi select + search + Multiselect and Search in angular 13 
Typescript :: typescript cast to parent type 
Typescript :: carousel not moving unless reload the page 
Typescript :: jquery to typescript converter online 
Typescript :: how to get all the points of the circufrence python 
Typescript :: dots are displaying only when trying to fetch records html template 
Typescript :: how to pass data between requests 
Typescript :: Scroll,Position 
Typescript :: difference known_hosts authorized_keys 
Typescript :: axios append array to params 
Typescript :: Rails flags for tests assets and helpers 
Typescript :: python unix get 5 minuts from now 
Typescript :: How many arguments are in this function call? range(0, 100, 5) 20 
Typescript :: get list of property values from list of objects swift 
Typescript :: 4. In order to have proper integration of the pulse current it is desired that 
Typescript :: i like 
Typescript :: in javaWrite a plan that prints all the perfect numbers in the range of 1 to 1000 
Typescript :: typescript enum includes value 
Typescript :: split a column of lists pandas 
Typescript :: 2d array of strings and ints python 
Typescript :: how to mark plots octave 
Cpp :: git branch in my bash prompt 
Cpp :: how to print a string to console in c++ 
Cpp :: how to check datatype of a variable in c++ 
Cpp :: simple C++ game code 
Cpp :: cpp speed cin cout 
Cpp :: angle to vector2 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =