changed from using input fields for keys to getting from url (#17)
* changed from using input fields for keys to getting from url * cleaned
This commit is contained in:
parent
a45bcf3d35
commit
7b841e9498
3 changed files with 53 additions and 73 deletions
9
app.js
9
app.js
|
@ -29,7 +29,6 @@ app.get('/assets/download/:id', function(req, res) {
|
|||
res.send('error');
|
||||
} else {
|
||||
res.setHeader('Content-Disposition', 'attachment; filename=' + reply);
|
||||
// res.setHeader('Content-Transfer-Encoding', 'binary');
|
||||
res.setHeader('Content-Type', 'application/octet-stream');
|
||||
|
||||
res.download(__dirname + '/static/' + reply);
|
||||
|
@ -38,7 +37,7 @@ app.get('/assets/download/:id', function(req, res) {
|
|||
|
||||
});
|
||||
|
||||
app.route('/upload')
|
||||
app.route('/upload/:id')
|
||||
.post(function (req, res, next) {
|
||||
|
||||
var fstream;
|
||||
|
@ -50,11 +49,11 @@ 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);
|
||||
res.send(id); //where to go next
|
||||
res.send(id);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -62,6 +61,6 @@ app.route('/upload')
|
|||
|
||||
|
||||
app.listen(3000, function () {
|
||||
console.log('Example app listening on port 3000!')
|
||||
console.log('Portal app listening on port 3000!')
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue