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!
Top comments (2)
If your resume upload feature is not working in your job portal, several factors may be causing the issue. First, check for file format and size restrictions as these are common reasons for upload failures. Additionally, ensure your internet connection is stable. If the issue persists, it may indicate a backend issue or outdated code in the platform. Collaborating with a reliable job portal app development company can help resolve such technical glitches efficiently. Professional developers can enhance your platform's functionality, ensuring smooth file uploads and improved user experience. Regular maintenance and testing are crucial for seamless portal performance.
Thanks for the asking question. It’s frustrating when the resume upload feature isn’t working. A reliable job portal development services can fix this issue by ensuring smooth file uploads and enhancing overall portal functionality. Dev Technosys offers expert job portal development services, focusing on seamless user experience and robust performance for both candidates and employers.