Move background file instead of copying+deleting
This commit is contained in:
parent
e7dce9b107
commit
c0a7472fe9
|
@ -76,10 +76,9 @@ router.post('/upload', urlencodedParser, function (request, response) {
|
|||
const filename = request.file.originalname;
|
||||
|
||||
try {
|
||||
fs.copyFileSync(img_path, path.join('public/backgrounds/', filename));
|
||||
fs.renameSync(img_path, path.join('public/backgrounds/', filename));
|
||||
invalidateThumbnail('bg', filename);
|
||||
response.send(filename);
|
||||
fs.unlinkSync(img_path);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
response.sendStatus(500);
|
||||
|
|
Loading…
Reference in New Issue