I am serving up my web application using NodeJS server (ExpressJS) currently. One of the new requirements is for the users to be able to upload large videos (potentially in gigs
var express = require("express");
var app = express();
var async = require('async');
var fs = require('fs');
var client = redis.createClient();
var multiparty = require('multiparty');
var util = require('util');
app.post('/',function(req,res){
var form = new multiparty.Form();
form.parse(req, function(err, fields, files) {
client.get(fields.otp, function(err, reply) {
var oldpath = files.file[0].path;
var newpath = path + files.file[0].originalFilename;
fs.rename(oldpath, newpath, function (err) {
if (err) throw err;
res.write('File uploaded and moved!');
res.end();
});
}
}
app.listen(2001,function(){
console.log("Server is running on port 2001");
});