finalTargetFile
This commit is contained in:
@@ -133,6 +133,8 @@ app.post("/upload/resources", upload.array("files"), (req, res) => {
|
|||||||
if (!fs.existsSync(targetDir)) {
|
if (!fs.existsSync(targetDir)) {
|
||||||
fs.mkdirSync(targetDir);
|
fs.mkdirSync(targetDir);
|
||||||
}
|
}
|
||||||
|
let finalTargetFile = targetDir+"/"+onefile.file_name;
|
||||||
|
console.log(finalTargetFile);
|
||||||
|
|
||||||
req.files.map(( onefile )=>{
|
req.files.map(( onefile )=>{
|
||||||
{
|
{
|
||||||
@@ -140,7 +142,7 @@ app.post("/upload/resources", upload.array("files"), (req, res) => {
|
|||||||
|
|
||||||
console.log( onefile );
|
console.log( onefile );
|
||||||
|
|
||||||
fs.rename(onefile.path, targetDir+"/"+onefile.file_name , function (err) {
|
fs.rename(onefile.path, finalTargetFile , function (err) {
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
console.log('Successfully renamed - '+onefile.path);
|
console.log('Successfully renamed - '+onefile.path);
|
||||||
console.log('Start::Database Registration!');
|
console.log('Start::Database Registration!');
|
||||||
|
|||||||
Reference in New Issue
Block a user