Added media move.
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import { Request, Response } from "express";
|
||||
import fs from "fs-extra";
|
||||
import multer from "multer";
|
||||
import path from "path";
|
||||
import GenerateThumbnail from "../util/generateThumbnail";
|
||||
import GenerateUrl from "../util/MediaUrlGen";
|
||||
import { FolderPaths } from "../util/serverInit";
|
||||
import multer from "multer";
|
||||
import { JobsListMedia } from "./jobsListMedia";
|
||||
|
||||
export const JobMediaUploadMulter = multer({
|
||||
storage: multer.diskStorage({
|
||||
@@ -14,7 +13,13 @@ export const JobMediaUploadMulter = multer({
|
||||
cb(null, DestinationFolder);
|
||||
},
|
||||
filename: function (req, file, cb) {
|
||||
cb(null, file.originalname);
|
||||
console.log(path.basename(file.originalname));
|
||||
cb(
|
||||
null,
|
||||
`${file.originalname}-${Math.floor(Date.now() / 1000)}.${path.extname(
|
||||
file.originalname
|
||||
)}`
|
||||
);
|
||||
},
|
||||
}),
|
||||
});
|
||||
@@ -46,10 +51,10 @@ export async function jobsUploadMedia(req: Request, res: Response) {
|
||||
);
|
||||
});
|
||||
await Promise.all(thumbnailGenerationQueue);
|
||||
res.json(thumbnailGenerationQueue);
|
||||
|
||||
JobsListMedia(req, res);
|
||||
}
|
||||
} catch (err) {
|
||||
res.status(500).send(err);
|
||||
}
|
||||
res.json();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user