pr changes
This commit is contained in:
parent
4968e501e1
commit
bb5e05319a
16
app.js
16
app.js
|
@ -72,25 +72,21 @@ app.post("/upload/:id", function (req, res, next) {
|
||||||
file.pipe(fstream);
|
file.pipe(fstream);
|
||||||
fstream.on("close", function () {
|
fstream.on("close", function () {
|
||||||
let id = req.params.id;
|
let id = req.params.id;
|
||||||
let uuid = Math.floor(Math.random() * 10000000).toString()
|
let uuid = crypto.randomBytes(10).toString('hex');
|
||||||
+ Math.floor(Math.random() * 10000000).toString()
|
|
||||||
+ Math.floor(Math.random() * 10000000).toString();
|
|
||||||
|
|
||||||
client.hset(id, "filename", filename);
|
client.hmset([id, "filename", filename, "delete", uuid]);
|
||||||
client.hset(id, "expiration", 0);
|
|
||||||
client.hset(id, "delete", uuid);
|
|
||||||
|
|
||||||
// delete the file off the server in 24 hours
|
// delete the file off the server in 24 hours
|
||||||
setTimeout(function() {
|
// setTimeout(function() {
|
||||||
fs.unlinkSync(__dirname + "/static/" + id);
|
// fs.unlinkSync(__dirname + "/static/" + id);
|
||||||
}, 86400000);
|
// }, 86400000);
|
||||||
|
|
||||||
client.expire(id, 86400000);
|
client.expire(id, 86400000);
|
||||||
console.log("Upload Finished of " + filename);
|
console.log("Upload Finished of " + filename);
|
||||||
res.send(uuid);
|
res.send(uuid);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(3000, function () {
|
app.listen(3000, function () {
|
||||||
console.log("Portal app listening on port 3000!")
|
console.log("Portal app listening on port 3000!")
|
||||||
|
|
Loading…
Reference in New Issue