From 2d9bdc7a4dd46a400745fb15c6b0b63d9b657c5a Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sun, 26 May 2024 13:23:29 -0400 Subject: [PATCH] finalTargetFile --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 7b1fcd7..7c1bada 100644 --- a/index.js +++ b/index.js @@ -133,6 +133,8 @@ app.post("/upload/resources", upload.array("files"), (req, res) => { if (!fs.existsSync(targetDir)) { fs.mkdirSync(targetDir); } + let finalTargetFile = targetDir+"/"+onefile.file_name; + console.log(finalTargetFile); req.files.map(( onefile )=>{ { @@ -140,7 +142,7 @@ app.post("/upload/resources", upload.array("files"), (req, res) => { console.log( onefile ); - fs.rename(onefile.path, targetDir+"/"+onefile.file_name , function (err) { + fs.rename(onefile.path, finalTargetFile , function (err) { if (err) throw err console.log('Successfully renamed - '+onefile.path); console.log('Start::Database Registration!');