최예리

directory remove complete

......@@ -46,7 +46,7 @@ app.post('/directory_check', (req, res) => {
if(fs.existsSync(dataFolder + '/' + dir))
{
// Go back page
res.sendfile('./views/error_directoryAdd.html');
res.render('error_directoryAdd');
}
// Directory doesn't exist
else
......@@ -76,19 +76,19 @@ app.get('/home/:directoryName/upload', (req, res) => {
// Delete Directory
app.get('/home/:directoryName/delete', (req, res) => {
// exist query.real
if (req.query.real != undefined) {
var directoryName = req.params.directoryName;
if (req.query.real) {
// Remove Directory and Files
path = dataFolder + '/' + directoryName;
var path = dataFolder + '/' + directoryName;
fs.readdirSync(path).forEach(function(file,index){
var curPath = path + "/" + file;
fs.unlinkSync(curPath);
});
fs.rmdirSync(path);
res.redirect('/home/');
res.redirect('/');
}
else {
res.sendfile('./views/directoryDeleteCheck.html');
res.render('directoryDeleteCheck');
}
});
......
<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
script.
confirm("모든 이미지가 삭제됩니다. 정말 분류를 삭제하시겠습니까?") ? location.href = location + 'real=true' : history.back();
script.
alert("이미 존재하는 분류입니다.");
history.back();
\ No newline at end of file
......@@ -8,12 +8,12 @@ html
p 새로 만들 분류명:
input(name="directoryName", type="text")
input(type="submit", value="생성")
p
br
form(action="test" method="post" enctype="multipart/form-data")
p 테스트할 이미지:
input(name="ImageTest", type="file")
input(type="submit", value="테스트")
br
ul
- var folderList=fileList
each folder in folderList
......