I have written a node.js code which is basically uploading a file to desired folder. the code is as shown below:
app.post('/upload', function(req, res) {
req.pipe(req.busboy);
req.busboy.on('file', function(fieldname, file, filename) {
var fstream = fs.createWriteStream('./python_codes/' + filename);
file.pipe(fstream);
fstream.on('close', function () {
res.send('upload succeeded!');
console.log("fileuploaded")
});
});
});
but on clicking the upload button on client side it is redirecting to new page. instead of redirecting I want to show a alert message. Thanks in advance!
via nishant kumar
No comments:
Post a Comment