CODE:
var upload = multer({dest:"./uploads"});
app.post("/", upload.single("file"), function (req, res, next) {
res.send(req.file.fileSize+"bytes");
});
EJS FILE:
<h1>Get the File Size of your Upload !</h1>
<form enctype="multipart/form-data" method="post" action="/" name="file">
<input type="file" class="form-control">
<button type = "submit" class = "btn btn-default">Submit</button>
</form>
QUESTION:
What have I done wrong ?
Add name = 'file' to input
<h1>Get the File Size of your Upload !</h1>
<form enctype="multipart/form-data" method="post" action="/">
<input type="file" class="form-control" name="file">
<button type = "submit" class = "btn btn-default">Submit</button>
</form>