Node.js Image Uploading With Multer

Traversy Media · 246K views · 2017 · 37:11

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as a practical walkthrough of image uploads with Multer, both in answers to upload problems and as the tutorial askers say they followed.

Recommended by 2 people across 2 different months, 2018 to 2020.

What it is

A 37-minute project tutorial from Traversy Media on uploading files and images in Node.js with the Multer middleware. It builds a small app using the EJS template engine and MaterializeCSS for the form UI.

What people said

Recommends MSKH · 2018-07 · Stack Overflow · on “Cannot find the file URL using xhr.open('post',url,true) - Status: 404 node js”

The problem indeed was with setting up a server side route, this was mostly clarified, thanks to the answer from @Arkita and comment from @Kasper. But I went ahead to dig for a solution, which may not be very useful to others as this was a dumb question in the first place, but here it goes.. On client side xhr.open('post','/saveImage/save',true); on server side if you are using Express.js or other connect based frameworks app.post('/saveImage/save',(req,res,next)=> {....}) Also the example I linked above may be outdated, this [this video] seems more helpful.

Recommends Daud Semab · 2020-06 · Stack Overflow · on “How to get back file in node server?”

You can grab the actual file using multer in your node express backend. Even you not tell which tools and libraries you are using in frontend. You also did not share you code. Here is cool article for react to node file uploading: Here it Goes [LINK] If you are not using react and using simple html and js then this [this video] will be a good video for you. If you watch this video, this is for images but all code is same just you have to change extensions names. If both the cases are not for you then share you code so the programmers can watch where are you making mistakes.

Cites Michel · 2018-10 · Stack Overflow · on “How to upload a blob with Multer?”

I have been following this video [this video] in order to know how to use Multer to upload files. I have then implemented an image-upload feature in one Node.js app of mine. Now I would like to use Multer to upload the contents of a blob containing audio data. What is the way to go? I already tried a bit following what I learned, but I already have some issues: I am now dealing with audio data instead of graphic data. I do not have a field name any more to put as an argument for the multer({ storage: storage }).single(...); function call. I hope someone with experience (using Multer ) will provide some guidance on this. For reference, here is my code for when the upload button is clicked: uploadV

Cites panji gemilang · 2019-08 · Stack Overflow · on “Is it possible to export module inside a function?”

So I just watched some tutorials on Youtube it's about uploading a file with Multer [this video] . I need to export the variable gfs when it's connected to my /routes folder, but how can I do that? const mongoose = require("mongoose") const Grid = require("gridfs-stream") // Routes const user = require("./routes/api/users") // Init gfs let gfs // create gfs on connection 'open' mongoose.connection .once("open", () => { // Init stream gfs = Grid(mongoose.connection.db, mongoose.mongo) gfs.collection("uploads") console.log("mongoDB connected and gfs has been created") }) .on("error", err => { console.log("connection error", err) }) // I need the gfs on the user routes // use routes app.use("/api/us