Simple Image Upload with Node on Amazon S3

Filip Jerga · 45K views · 2018 · 31:55

Open on YouTube

Web developmentCloud, DevOps & reliabilitytutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering or asking how to upload files and images to S3 from Node with multer-s3, treating it as the step-by-step reference to follow.

Recommended by 1 people across 1 different months, 2019 to 2020.

What it is

A 32-minute tutorial by Filip Jerga on uploading images from a Node.js server to an Amazon S3 bucket, using Express and multer-s3. It is the first part of a series, with a follow-up covering image upload from Angular and React front ends.

What people said

Recommends Michael Sanderson · 2020-06 · Stack Overflow · on “How to upload video files into an S3 bucket using React”

Use the multer-s3 node package as it used in this tutorial: [this video] and add the contentType: multerS3.AUTO_CONTENT_TYPE to the multer object like so. var upload = multer({ storage: multerS3({ s3: s3, bucket: 'some-bucket', contentType: multerS3.AUTO_CONTENT_TYPE, metadata: function (req, file, cb) { cb(null, {fieldName: file.fieldname}); }, key: function (req, file, cb) { cb(null, Date.now().toString()) } }) }) This will set the Content-type metadata to video/quicktime for the bucket object when you upload a video file. These video objects can be played back using a media player and the object url from s3.

Cites Srikanth86in · 2019-01 · Stack Overflow · on “How to upload the images to s3 bucket using nodejs?”

I am new to aws. I want upload an image from node js using multer to s3 bucket. I have followed the tutorial on youtube but am getting stuck with this error. [this video] TypeError: Cannot read property 'location' of undefined" error.(POSTMAN) Please help me figure out the problem.Thank you for help file_upload.js const express = require("express"); const app = express(); const upload = require("./file_upload"); const singleUpload = upload.single("image"); app.post("/image-upload", function(req, res) { singleUpload(req, res, function(err, some) { if (err) { return res.status(422).send({ errors: [{ title: "Image Upload Error", detail: err.message }] }); } return res.json({ imageUrl: req.file.locat

Cites nCardot · 2020-07 · Stack Overflow · on “500 error when sending POST request to multer-s3 route”

I'm trying to use S3, specifically multer-s3 , for image upload for a traditional web app that currently has multer /file system file upload (GitHub repo with previous code before the failed S3 upload attempt can be found here [LINK] ). The app is deployed to Heroku, which has ephemeral file storage, so the old setup is a no-go. I tried to use multer-s3 to do it based on this tutorial [this video] , but got up to about 20 mins in, trying to send the POST request to the new image-upload route but am getting a 500 error, whereas in the tutorial an AWS image path is provided in the response. Here's what I tried so far: I created a bucket and get my access code and keys. In my S3 bucket settings, und