Set metadata when uploading images to s3 or spaces


By default the image arrives at s3 with Content-Type: application / octet-stream. How can I change this at upload time? And, if possible, how can I make the object sent public rather than private?

const validations = {
      types: ['image'],
      size: '2mb'

    request.multipart.file('image', validations, async (file) => {
      await Drive.disk('spaces').put(`uploads/${uuid.v4()}.${file.extname}`,

    await request.multipart.process()
1 Like


Hi there @clayderson :wave:
I use a third parameter for the put method like this:

await Drive.disk('do').put(fileName, data, {
        ACL: 'public-read',
        ContentType: 'image/jpeg'

to specify the content type and to make the image public
Hope it helps

1 Like


Hi @melokki

Perfect!!! Thank you so much, you saved me from a lot of work.



You’re welcome :slight_smile: