CODE:
var upload = multer({dest:"./uploads"});
app.post("/", upload.single("file"), function (req, res, next) {
res.send(req.file.fileSize+"bytes");
});
EJS文件:
<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>
问题:
我做错了什么?
答案 0 :(得分:1)
添加姓名=&#39;文件&#39;输入
<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>