Showing
5 changed files
with
13 additions
and
15 deletions
... | @@ -46,7 +46,7 @@ app.post('/directory_check', (req, res) => { | ... | @@ -46,7 +46,7 @@ app.post('/directory_check', (req, res) => { |
46 | if(fs.existsSync(dataFolder + '/' + dir)) | 46 | if(fs.existsSync(dataFolder + '/' + dir)) |
47 | { | 47 | { |
48 | // Go back page | 48 | // Go back page |
49 | - res.sendfile('./views/error_directoryAdd.html'); | 49 | + res.render('error_directoryAdd'); |
50 | } | 50 | } |
51 | // Directory doesn't exist | 51 | // Directory doesn't exist |
52 | else | 52 | else |
... | @@ -76,19 +76,19 @@ app.get('/home/:directoryName/upload', (req, res) => { | ... | @@ -76,19 +76,19 @@ app.get('/home/:directoryName/upload', (req, res) => { |
76 | // Delete Directory | 76 | // Delete Directory |
77 | app.get('/home/:directoryName/delete', (req, res) => { | 77 | app.get('/home/:directoryName/delete', (req, res) => { |
78 | // exist query.real | 78 | // exist query.real |
79 | - if (req.query.real != undefined) { | 79 | + var directoryName = req.params.directoryName; |
80 | + if (req.query.real) { | ||
80 | // Remove Directory and Files | 81 | // Remove Directory and Files |
81 | - path = dataFolder + '/' + directoryName; | 82 | + var path = dataFolder + '/' + directoryName; |
82 | fs.readdirSync(path).forEach(function(file,index){ | 83 | fs.readdirSync(path).forEach(function(file,index){ |
83 | var curPath = path + "/" + file; | 84 | var curPath = path + "/" + file; |
84 | fs.unlinkSync(curPath); | 85 | fs.unlinkSync(curPath); |
85 | }); | 86 | }); |
86 | fs.rmdirSync(path); | 87 | fs.rmdirSync(path); |
87 | - | 88 | + res.redirect('/'); |
88 | - res.redirect('/home/'); | ||
89 | } | 89 | } |
90 | else { | 90 | else { |
91 | - res.sendfile('./views/directoryDeleteCheck.html'); | 91 | + res.render('directoryDeleteCheck'); |
92 | } | 92 | } |
93 | }); | 93 | }); |
94 | 94 | ... | ... |
views/directoryDeleteCheck.html
deleted
100644 → 0
views/directoryDeleteCheck.pug
0 → 100644
views/error_directoryAdd.pug
0 → 100644
... | @@ -8,12 +8,12 @@ html | ... | @@ -8,12 +8,12 @@ html |
8 | p 새로 만들 분류명: | 8 | p 새로 만들 분류명: |
9 | input(name="directoryName", type="text") | 9 | input(name="directoryName", type="text") |
10 | input(type="submit", value="생성") | 10 | input(type="submit", value="생성") |
11 | - p | 11 | + br |
12 | form(action="test" method="post" enctype="multipart/form-data") | 12 | form(action="test" method="post" enctype="multipart/form-data") |
13 | p 테스트할 이미지: | 13 | p 테스트할 이미지: |
14 | input(name="ImageTest", type="file") | 14 | input(name="ImageTest", type="file") |
15 | input(type="submit", value="테스트") | 15 | input(type="submit", value="테스트") |
16 | - | 16 | + br |
17 | ul | 17 | ul |
18 | - var folderList=fileList | 18 | - var folderList=fileList |
19 | each folder in folderList | 19 | each folder in folderList | ... | ... |
-
Please register or login to post a comment