Showing
5 changed files
with
19 additions
and
14 deletions
This diff is collapsed. Click to expand it.
| ... | @@ -27,7 +27,8 @@ input : 사용자가 연락처를 저장해놓은 csv 혹은 xlsx 파일 | ... | @@ -27,7 +27,8 @@ input : 사용자가 연락처를 저장해놓은 csv 혹은 xlsx 파일 |
| 27 | output : 연락처 저장 성공 여부 | 27 | output : 연락처 저장 성공 여부 |
| 28 | */ | 28 | */ |
| 29 | router.post('/contact_upload', upload.single('file'), function(req, res, next) { | 29 | router.post('/contact_upload', upload.single('file'), function(req, res, next) { |
| 30 | - // console.log(req); | 30 | + |
| 31 | + console.log(req); | ||
| 31 | var user_id = req.query.id; | 32 | var user_id = req.query.id; |
| 32 | var file = req.file; | 33 | var file = req.file; |
| 33 | var workbook = XLSX.readFile('public/upload/contact.xlsx'); | 34 | var workbook = XLSX.readFile('public/upload/contact.xlsx'); |
| ... | @@ -39,7 +40,7 @@ router.post('/contact_upload', upload.single('file'), function(req, res, next) { | ... | @@ -39,7 +40,7 @@ router.post('/contact_upload', upload.single('file'), function(req, res, next) { |
| 39 | var added_date = []; | 40 | var added_date = []; |
| 40 | var length = firstWSheet['!ref'][4]; | 41 | var length = firstWSheet['!ref'][4]; |
| 41 | var temp =""; | 42 | var temp =""; |
| 42 | - | 43 | + console.log("업로드 api 호출") |
| 43 | var sqlquery = "insert into contact(user_id,name,email,phone,added_date) values"; | 44 | var sqlquery = "insert into contact(user_id,name,email,phone,added_date) values"; |
| 44 | for(var i=1;i<length;i++) | 45 | for(var i=1;i<length;i++) |
| 45 | { | 46 | { | ... | ... |
| 1 | { | 1 | { |
| 2 | - "accessKeyId": "ASIAXZL2SWFEWQZ6ZNEU", | 2 | + "accessKeyId": "ASIAXZL2SWFEQ3A42BQP", |
| 3 | - "secretAccessKey": "lqUJTmGVElVEJ6RIgacZd1n1ARvVSNrT3JisfpsO", | 3 | + "secretAccessKey": "7VxG6RfekqWejvtLfdgLtZbxpXcUg6NshtTueiUV", |
| 4 | - "sessionToken": "FwoGZXIvYXdzEJv//////////wEaDJAjP1JBdrIxgxqlTyLDAQCU1f4zp5nu4cNnp4U0pRa9ZGqjQKlxjsUWwH478XU6XUNJcN2NMmmZ0Cl8/kHz+GMvmgax7RxSpo0VsaReh/9+1SMcOB3Kcc+sqRivkCBAZAXfaKrdKhuR2WyCe+M+sZKXdqXNpzHPa/6tUVDBNIMC/aH1KMCwi6XChO3M4BBMZNeY73bu7dLcvPVfaBmRQpaTrqTRky7YiwcPHnnMabOLR6k8OX7Uq/gIYx4pWCJ7AGbVts/quDqoK4nWMs+9Ah6A1CjP4Pn2BTItGKcDLysH3w7vuuw+5dcrxRcFawD0sbOGkJ2YX7fvxHPf410Sm4Vyo2Jf94hM", | 4 | + "sessionToken": "FwoGZXIvYXdzEMP//////////wEaDBXRmjIedzbi/hfWTCLDAY+AZ+EfzHvy0eV/zjF53n2JhNPJADGD+T32qA6dsBBNs4EyfXoejbu/9k1Evr2h042JwGLb7rZpnEFk46KoGGqo/mBRr+PLlKExbfnPLE6s3SRT0sdqgXkXS+7gQ/Y4aBB1+WLBySso2GxwftcUEJS/pC2YUdonzEpypIRUGD87aJaaMKIc5i9U7oh8uDht2FXWBEIWjhJAkBd+xuMyrhjq474NYCbQlQtG5annxEz5F5MQuKBKCk4G2yPlkGQ7Z0DmgyiNzIL3BTItePAyPGDb/Mvl+8aUiEgkysdTY0YUMhLaepwCzwlV9nuyfpVV2SH5gMoDmKoD", |
| 5 | "region": "us-east-1" | 5 | "region": "us-east-1" |
| 6 | } | 6 | } | ... | ... |
| ... | @@ -109,17 +109,17 @@ function addFavoriteFile(fileData) { | ... | @@ -109,17 +109,17 @@ function addFavoriteFile(fileData) { |
| 109 | return axios.post('api/favorites/addfile', fileData); | 109 | return axios.post('api/favorites/addfile', fileData); |
| 110 | } | 110 | } |
| 111 | function uploadContact(contactData){ | 111 | function uploadContact(contactData){ |
| 112 | - return axios.post('/api/contact/contact_upload', contactData); | 112 | + return axios.post('/api/contact/contact_upload', contactData,{ |
| 113 | + headers: { | ||
| 114 | + 'Content-Type': 'multipart/form-data', | ||
| 115 | + }, | ||
| 116 | + }); | ||
| 113 | } | 117 | } |
| 114 | function downloadContact(userID){ | 118 | function downloadContact(userID){ |
| 115 | return axios.post('/api/contact/contact_download', userID); | 119 | return axios.post('/api/contact/contact_download', userID); |
| 116 | } | 120 | } |
| 117 | function printContact(userID){ | 121 | function printContact(userID){ |
| 118 | - return axios.post('/api/contact/contact_list', userID, { | 122 | + return axios.post('/api/contact/contact_list', userID); |
| 119 | - headers: { | ||
| 120 | - 'Content-Type': 'multipart/form-data', | ||
| 121 | - }, | ||
| 122 | - }); | ||
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | export { | 125 | export { | ... | ... |
| ... | @@ -70,15 +70,19 @@ | ... | @@ -70,15 +70,19 @@ |
| 70 | if(!droppedFiles) return; | 70 | if(!droppedFiles) return; |
| 71 | console.log(droppedFiles); | 71 | console.log(droppedFiles); |
| 72 | }, | 72 | }, |
| 73 | - async upload_conatct(){ | 73 | + async upload_contact(){ |
| 74 | try { | 74 | try { |
| 75 | const formData = new FormData(); | 75 | const formData = new FormData(); |
| 76 | formData.append('file', this.contact_file); | 76 | formData.append('file', this.contact_file); |
| 77 | - formData.append('user_id', this.$store.state.id); | 77 | + formData.append('id', this.$store.state.id); |
| 78 | const currentData = { | 78 | const currentData = { |
| 79 | id: this.$store.state.id | 79 | id: this.$store.state.id |
| 80 | }; | 80 | }; |
| 81 | - console.log(currentData); | 81 | + const fileData = { |
| 82 | + id: this.$store.state.id, | ||
| 83 | + file: this.contact_file | ||
| 84 | + } | ||
| 85 | + console.log(fileData); | ||
| 82 | const response = await uploadContact(formData); | 86 | const response = await uploadContact(formData); |
| 83 | const contact_response = await printContact(currentData); | 87 | const contact_response = await printContact(currentData); |
| 84 | console.log(contact_response); | 88 | console.log(contact_response); | ... | ... |
-
Please register or login to post a comment