Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-CloudComputing
/
D_Team_Khuloud
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
toror33
2020-06-10 21:45:52 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b6b63308bef07e2a6dfd3224858f0b1e2e06c570
b6b63308
1 parent
6b4c0e8c
연락처 다운로드 오류 수정
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
backend/routes/contact.js
backend/routes/contact.js
View file @
b6b6330
...
...
@@ -93,16 +93,13 @@ router.post('/contact_download', function(req, res, next) {
var
filename
=
'public/upload/contactdownload.xlsx'
;
fs
.
exists
(
filename
,
function
(
exists
)
{
console
.
log
(
exists
);
if
(
exists
==
true
)
{
fs
.
unlink
(
filename
,
function
(
err
)
{
if
(
err
)
throw
err
;
console
.
log
(
'file deleted'
);
});
}
});
// Create a new instance of a Workbook class
var
wb
=
new
xl
.
Workbook
();
...
...
@@ -135,10 +132,14 @@ router.post('/contact_download', function(req, res, next) {
ws
.
cell
(
i
+
2
,
4
).
string
(
rows
[
i
].
added_date
);
}
}
wb
.
write
(
'public/upload/contactdownload.xlsx'
);
var
file
=
__dirname
+
'/public/upload/contactdownload.xlsx'
;
// console.log(file);
res
.
download
(
file
);
wb
.
write
(
'public/upload/contactdownload.xlsx'
,
(
err
,
stats
)
=>
{
if
(
err
){
throw
err
;
}
else
{
res
.
sendFile
(
path
.
join
(
__dirname
,
'../public/upload/contactdownload.xlsx'
));
}
});
}
});
...
...
Please
register
or
login
to post a comment