I am building a web app using nodejs express and ejs that will allow users to upload photos to the server from the UI but for some reason the images are not appearing in the folder after being uploaded. Here is the code that handles the upload:
app.post('/upload', (req, res) => {
// Get the file that was set to our field named "image"
const { image } = req.files;
// If no image submitted, exit
if (!image) {
return res.sendStatus(400);
}
// If does not have image mime type prevent from uploading
//if (/^image/.test(image.mimetype)) return res.sendStatus(400);
// Move the uploaded image to our upload folder
image.mv(__dirname + '/images/home' + image.name);
console.log({ image });
res.redirect("/upload");
});
Now I know the image is received from the console.log({ image }); I receive all the image data and the page is redirected to the upload route. This was working before but now I receive this error in the browser console:
DevTools failed to load source map: Could not load content for chrome-extension://fheoggkfdfchfphceeifdbepaooicaho/sourceMap/chrome/scripts/content_scroll_mid_detection.map: System error: net::ERR_BLOCKED_BY_CLIENT
Not sure if this has anything to do with why the image doesnt show up in the folder but I have searched the internet to no avail and cannot resolve this problem please help.
Here is the upload form in case this is helpful:
<form action="/upload" method="POST" enctype="multipart/form-data">
<input type="file" name="image" />
<button type="submit">Upload</button>
</form>