changed from using input fields for keys to getting from url

This commit is contained in:
Abhinav Adduri 2017-05-30 13:55:06 -07:00
parent a45bcf3d35
commit 82eccc6d54
3 changed files with 48 additions and 22 deletions

4
app.js
View file

@ -38,7 +38,7 @@ app.get('/assets/download/:id', function(req, res) {
});
app.route('/upload')
app.route('/upload/:id')
.post(function (req, res, next) {
var fstream;
@ -50,7 +50,7 @@ app.route('/upload')
fstream = fs.createWriteStream(__dirname + '/static/' + filename);
file.pipe(fstream);
fstream.on('close', function () {
let id = Math.floor(Math.random()*10000).toString();
let id = req.params.id;
client.hset(id, "filename", filename, redis.print);
client.hset(id, "expiration", 0, redis.print);
console.log("Upload Finished of " + filename);