최예리

directoryDeleteCheck 파일에 문제가 있음.

......@@ -74,9 +74,22 @@ app.get('/home/:directoryName/upload', (req, res) => {
// Delete Directory
app.delete('/home/:directoryName', (req, res) => {
app.get('/home/:directoryName/delete', (req, res) => {
// exist query.real
if (req.query.real != undefined) {
// Remove Directory and Files
path = dataFolder + '/' + directoryName;
fs.readdirSync(path).forEach(function(file,index){
var curPath = path + "/" + file;
fs.unlinkSync(curPath);
});
fs.rmdirSync(path);
res.redirect('/home/');
}
else {
res.sendfile('./views/directoryDeleteCheck.html');
}
});
......
......@@ -5,5 +5,5 @@ html
title 파일 업로드
body
form(action="upload" method="POST" enctype="multipart/form-data")
input(type="file", name="userfile")
input(type="file", name="userfile[]", multiple="multiple")
input(type="submit", value="전송")
\ No newline at end of file
......
<script type="text/javascript">
var delete = confirm("모든 이미지가 삭제됩니다.\n정말 분류를 삭제하시겠습니까?")
if(delete)
window.location.href = window.location + '?real=true'
else
history.back()
</script>
\ No newline at end of file
......@@ -18,7 +18,7 @@ html
- var folderList=fileList
each folder in folderList
li=folder
form(action=folder method="get")
input(type="submit", value="편집")
form(action=folder method="delete")
input(type="submit", value="삭제")
\ No newline at end of file
form(action="home/"+folder method="get")
input(type="submit", value="편집")
form(action="home/"+folder+"/delete" method="get")
input(type="submit", value="삭제")
\ No newline at end of file
......