I have the following code, and when I upload a file, it just starts counting the % in the status bar and once reached 100% I get a 404 error on the file-upload path.
What might be the problem?
<form action="/file-upload", method="post", enctype="multipart/form-data">
<input type="file", name="displayImage", id="file"></input>
<input type="submit"></input>
app.post('/file-upload', function(req,res,next) {
var fstream;
req.pipe(req.busboy);
req.busboy.on('file', function (fieldname, file, filename) {
console.log("Uploading: " + filename);
fstream = fs.createWriteStream(__dirname + '/files/' + filename);
file.pipe(fstream);
fstream.on('close', function () {
res.redirect('back');
});
});