0

I'm trying to pipe a file that I send with FilePond for React, get with on my expressjs and upload to s3 with multer and multer-s3. I have seen tutorials that specify that the best way to name the files dynamically is to declare a callback on the key but if I do not set a value directly, it simply ignores is and the whole multer middleware sends a success message.

Here is what I'm doing in express:

const app = express(); app.use(bodyParser.urlencoded({ extended: true }))

var upload = multer({ storage: multerS3({ s3: s3, bucket: aws_bucket_name, ACL: "public-read", key: (req, file, cb) => { console.log("This never gets called"); console.log(req.body); console.log(file); cb(null, avatars/${req.params.uid}); } }) });

app.post('/avatar/:uid', upload.single('file'), async (req, res, next) => { console.log("this gets called") res.send("uploaded") });

I'm using ES6, and am doing exactly as the documentation suggests. Any ideas why this might not be working?

Thanks!

Jacobo Koenig
  • 11,728
  • 9
  • 40
  • 75

0 Answers0