Upload File in Node.js & MySQL Using Multer | Complete Image Upload Tutorial

Upload File in Node.js & MySQL Using Multer | Complete Image Upload Tutorial

T
Thapa Technical
May 13, 2025

Want to upload files in Node.js and store image URLs in MySQL like a pro?
In this video, I’ll walk you through the complete profile image upload process using Multer in Node.js — from setting up the backend to handling form data, saving image URLs, and displaying them using EJS.
We’ll also talk about req.file, avatarUrl, and common mistakes beginners make.
Perfect for anyone working with Express, MySQL, and EJS in full-stack apps!

📌 Topics Covered:

How file upload works under the hood

Setting up Multer (storage, filter, limits)

Creating avatar upload logic

Saving file URL in MySQL

Displaying profile pictures using EJS
📺 Watch the complete Node.JS Playlist here :https://youtube.com/playlist?list=PLwGdqUZWnOp3KELplHtc-RnJ5xTUPqdgH&si=_ob8F88HYxCdspup

🔥 Access Source Code, PPT & Notes here for Free : https://www.thapatechnical.com/2024/11/introduction-to-nodejs.html
------------------------------------------------------------------------
🚀 Boost Your Skills with these Pre-Requisite Videos:

🔗 Best HTML Course - https://youtu.be/5ccq_nLHneE
🔗 Best CSS Course - https://youtu.be/MSICFljRcb4
🔗 JavaScript Basics Course Part 1 - https://youtu.be/13gLB6hDHR8
🔗 JavaScript Advanced Course Part 2 - https://youtu.be/YwsOCN8woA8

------------------------------------------------------------------------
💸 Build Your Own E-commerce Website for Free! - https://www.thapatechnical.com/2024/03/build-complete-ecommerce-website-using.html

------------------------------------------------------------------------
✌️ Join Us!

🚀 Become a Member: Unlock perks, free source code, and more Join Now : https://www.youtube.com/channel/UCwfaAHy4zQUb2APNOGXUCCA/join
📷 Connect on Instagram: https://www.instagram.com/thapatechnical
🗨️ Join Our Discord Server: Hang out with fellow programmers Discord Link: https://discord.gg/MdScmCsua6

------------------------------------------------------------------------

⌛TIMELINE⏳
0:00 INTRO TO FILE UPLOAD IN NODE & MYSQL
1:10 How file upload works
2:35 Advanced file upload logic explained
3:50 Very important step before uploading files
5:05 Installing Multer and setting variables
7:58 Adding destination and filename in Multer
12:45 Filtering to accept only image mimetypes
13:30 What req.file looks like (console example)
15:20 Creating POST request using multer.single()
17:00 Defining controller functions for upload
20:10 Avatar schema setup for MySQL
22:11 Adding avatarUrl in getProfile controller
23:08 Understanding EJS part for uploading UI
26:30 Testing: Is our upload system working?
28:45 What’s next? Want me to cover image delete?