I am having problem with the file metadata project. Here is the html I am using
<form action="/upload" method="POST">
<input type="file" name="file">
<input type="submit">
</form>
and the nodejs code
var express = require('express');
var multer = require('multer');
var path = require('path');
var upload = multer({ dest: 'uploads/' })
var app = express()
app.use(express.static(path.join(__dirname,'public')))
// app.get('/', function(req, res){
// })
app.post('/upload', upload.single('file'),function(req, res){
if (req.file) {
res.json({size: req.file.size})
}
})
// process.env.PORT
app.listen(3000)
console.log('Server running on port 3000');
From what I have been able to figure out from the documentation, a folder called ‘uploads’ is created into which the files are uploaded. However the code does not work (the files are not uploaded in the folder). Also is there a way to avoid all the uploading?