Resume Upload Feature Not Working in Job Portal
Hello, I’m facing an issue with the resume upload feature in my job portal. Users can select a file, but when they submit the application, the resume is not being saved or linked to their profile. There are no visible errors in the UI, but the backend is not receiving the file properly. Here’s a snippet of my backend code (Node.js/Express with Multer): const multer = require("multer"); const storage = multer.diskStorage({ destination: (req, file, cb) => { cb(null, "uploads/resumes/"); }, filename: (req, file, cb) => { cb(null, Date.now() + "-" + file.originalname); } }); const upload = multer({ storage: storage }); app.post("/upload-resume", upload.single("resume"), async (req, res) => { try { if (!req.file) { return res.status(400).json({ error: "No file uploaded" }); } const user = await User.findById(req.body.userId); if (!user) { return res.status(404).json({ error: "User not found" }); } user.resumePath = req.file.path; await user.save(); res.status(200).json({ message: "Resume uploaded successfully" }); } catch (error) { console.error("Error uploading resume:", error); res.status(500).json({ error: "Internal Server Error" }); } }); Steps I've Tried: Checked if the uploads/resumes/ directory has the correct permissions. Logged req.file but it's coming as undefined. Ensured that the form has enctype="multipart/form-data". Has anyone encountered this issue before? Any help would be appreciated!

Hello,
I’m facing an issue with the resume upload feature in my job portal. Users can select a file, but when they submit the application, the resume is not being saved or linked to their profile. There are no visible errors in the UI, but the backend is not receiving the file properly.
Here’s a snippet of my backend code (Node.js/Express with Multer):
const multer = require("multer");
const storage = multer.diskStorage({
destination: (req, file, cb) => {
cb(null, "uploads/resumes/");
},
filename: (req, file, cb) => {
cb(null, Date.now() + "-" + file.originalname);
}
});
const upload = multer({ storage: storage });
app.post("/upload-resume", upload.single("resume"), async (req, res) => {
try {
if (!req.file) {
return res.status(400).json({ error: "No file uploaded" });
}
const user = await User.findById(req.body.userId);
if (!user) {
return res.status(404).json({ error: "User not found" });
}
user.resumePath = req.file.path;
await user.save();
res.status(200).json({ message: "Resume uploaded successfully" });
} catch (error) {
console.error("Error uploading resume:", error);
res.status(500).json({ error: "Internal Server Error" });
}
});
Steps I've Tried:
Checked if the uploads/resumes/ directory has the correct permissions.
Logged req.file but it's coming as undefined.
Ensured that the form has enctype="multipart/form-data"
.
Has anyone encountered this issue before? Any help would be appreciated!