We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const multerOptions = multer({ storage: imager({ accessKeyId: process.env.AWS_ACCESS, secretAccessKey: process.env.AWS_SECRET_KEY, bucket: process.env.AWS_BUCKET, region: process.env.AWSregion, /*acl: 'public-read', // Auto detect contet type contentType: multerS3.AUTO_CONTENT_TYPE, */ dirname: 'images', filename: function(req, file, cb) { const extension = file.mimetype.split('/')[1]; // gets the extension const area = 'test_'; const fileName = `${area}${uuid.v4()}.${extension}`; console.log('file name is ', fileName); cb(null, fileName); }, gm: { pool: 5, format: 'png', scale: { width: 200, height: 200, type: 'contain', }, crop: { width: 200, height: 200, x: 0, y: 0, }, rotate: 'auto', }, **// This part is not being executed.** fileFilter(req, file, next) { const isPhoto = file.mimetype.startsWith('image/'); console.log(req.files); if (isPhoto) { next(null, true); // null for error means it worked and it is fine to continue to next() console.log(isPhoto); } else { next({ message: 'Fotos: Tipo de arquivo não suportado!' }, false); // with error } }, s3: { Metadata: { ACL: 'public-read', customkey: 'data', }, }, }), }); exports.upload = multer(multerOptions).array('photos', 5);
Files are going to S3 with the right name but at zero bytes, the commented part is not getting executed either. Ideas?
The text was updated successfully, but these errors were encountered:
fileFilter must be at the same level as storage (https://github.com/expressjs/multer#multeropts) :
const upload = multer({ storage: multerS3Storage, fileFilter: fileFilter })
Sorry, something went wrong.
No branches or pull requests
Files are going to S3 with the right name but at zero bytes, the commented part is not getting executed either. Ideas?
The text was updated successfully, but these errors were encountered: