Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.post('/upload/new', requiresLogin, function(req, res) {
- req.form.complete(function(err, fields, files) {
- if(err) {
- next(err);
- } else {
- ins = fs.createReadStream(files.upload.path);
- ous = fs.createWriteStream(__dirname + '/public/uploads/' + files.upload.filename);
- util.pump(ins, ous, function(err) {
- if(err) {
- next(err);
- } else {
- res.redirect('/upload');
- }
- });
- }
- });
- });
- req.form.on('progress', function (bytesReceived, bytesExpected) {
- var percent = (bytesReceived / bytesExpected * 100) | 0;
- console.log("uploading: " + percent);
- });
Add Comment
Please, Sign In to add comment