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
박기범
2020-05-31 20:51:31 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
63886c0e9ac894fd27b8edc238b2b01a5722e9ef
63886c0e
1 parent
4a9dd77a
Download testing
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
103 additions
and
34 deletions
backend/routes/modules/awsconfig.json
backend/routes/modules/s3/s3.js
front-end/src/api/index.js
front-end/src/components/FileList.vue
backend/routes/modules/awsconfig.json
View file @
63886c0
{
"accessKeyId"
:
"ASIA
ZQ5XTMMF77IHPTR6
"
,
"secretAccessKey"
:
"
IIDj5U3n6603WcAOf2OMTj2V6urKuGQaRGXABtVd
"
,
"sessionToken"
:
"FwoGZXIvYXdzEN
H//////////wEaDLvwZHLSr6GbUZyD0yLDAVKxxzxNeyC41xtvOmvV9Xmeor5N/Uy6byi1/D/9K6OoGSwdgPNlyyz5EzCsB3UDWtyWGSmIX9PreX0FX2wnD5/VHDl9QibRMUpXOBlg95BNHrfx0e7Srfn6a1GY8eN9ntiqiv7DuS3jV7I7L9NOE218dxDnt4hul8gStVZ4urSXlz4KUAXLucCbF4y2c/KuDVqKPM/9+MQgnL6f3bHThwNEhZhm4CjyHQYZgB2eGd9HYi95RYC9NglBi1gH60Iao8AELSi8wc32BTItNSdy9ymXld6zjj9OnqNzUZdm+GdCX8qFQ87nzVzmX7kHEOWnK9x+4zTHbGXx
"
,
"accessKeyId"
:
"ASIA
XZL2SWFE22KE6FMR
"
,
"secretAccessKey"
:
"
xicAWumxI045y2H/gpvHj931ejPAxKx05z3s7306
"
,
"sessionToken"
:
"FwoGZXIvYXdzEN
T//////////wEaDMjAgd73D8cgPHM6cCLDARgKnP64irW5N1G56jblgQgjgf58Xwfr/Ysghx6udQ0sS5St5XOtnc/nMqukHOc//gqPaSgNZza57fmaIQVdTM8dgSbM6a72SbXirYO38YDfzHCQz73gg2DWAjrZy2RDu1v8lmshh3393B9MuZFEEJzDgsLgNAmQmP5iULRVqnVqRhUcuhMxFz91nsSuts1u0r41sBZTEwKjE3Qnor3PrUS7KKeZqi8axod4jEwLCDj+CW6N2l5I8QeXtanrKnHGVL4NiiiJlc72BTIt1pHEnchZvLii96Afs5ThV/018vTKHgqZl7m/QGHCVc5hwcNOU6MLnwSLHFYf
"
,
"region"
:
"us-east-1"
}
...
...
backend/routes/modules/s3/s3.js
View file @
63886c0
...
...
@@ -17,7 +17,7 @@
var
AWS
=
require
(
'aws-sdk'
);
AWS
.
config
.
update
({
region
:
'ap-northeast-2'
});
var
BUCKET_NAME
=
'
dkhuloud
'
;
var
BUCKET_NAME
=
'
qkrrlqja-test
'
;
var
s3
=
new
AWS
.
S3
();
var
fs
=
require
(
'fs'
);
...
...
front-end/src/api/index.js
View file @
63886c0
...
...
@@ -46,7 +46,11 @@ function file(curData){
function
uploadFile
(
fileData
){
return
axios
.
post
(
'/api/file/upload'
,
fileData
);
return
axios
.
post
(
'/api/file/upload'
,
fileData
,
{
headers
:{
'Content-Type'
:
'multipart/form-data'
}
});
}
function
detailFile
(
fileData
){
...
...
@@ -58,21 +62,19 @@ function detailFile(fileData){
})
}
function
deleteFile
(
fileData
){
return
axios
.
get
(
'/api/file/delete'
,
{
return
axios
.
get
(
`/api/file/delete/
${
fileData
.
fileName
}
`
,
{
params
:{
//현재 접속한 사람의 id와 삭제할 파일의 이름, 현재 폴더위치를 파라미터로 넘긴다.
id
:
fileData
.
id
,
name
:
fileData
.
fileName
,
id
:
fileData
.
user_id
,
cur
:
fileData
.
cur
}
});
}
function
downloadFile
(
fileData
){
return
axios
.
get
(
'api/file/download'
,
{
return
axios
.
get
(
`api/file/download/
${
fileData
.
fileName
}
`
,
{
params
:{
//현재 접속한 사람의 id와 다운로드를 위해 선택한 파일의 이름을 파라미터로 넘긴다.
id
:
fileData
.
id
,
name
:
fileData
.
fileName
,
cur
:
fileData
.
cur
}
});
...
...
front-end/src/components/FileList.vue
View file @
63886c0
...
...
@@ -94,18 +94,22 @@
<v-icon> mdi-file</v-icon>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title v-text="item"></v-list-item-title>
<v-list-item-title v-text="item
.file_name
"></v-list-item-title>
</v-list-item-content>
<v-list-item-action>
<v-btn icon>
<v-btn icon
@click="download_file(item.file_name)"
>
<v-icon color="grey lighten-1">mdi-information</v-icon>
</v-btn>
<v-btn icon>
<v-icon color="grey lighten-1">mdi-delted</v-icon>
<v-btn icon
@click="delete_file(item.file_name)"
>
<v-icon color="grey lighten-1">mdi-del
e
ted</v-icon>
</v-btn>
</v-list-item-action>
</v-list-item>
</v-list>
<input id = "file-selector" ref='uploadedfile' type="file"
v-on:change="handleFileUpload()">
<br>
<!--
<v-file-input
v-model="files"
color="deep-purple accent-4"
...
...
@@ -136,6 +140,7 @@
</template>
</v-file-input>
-->
<v-btn color="blue" @click = "upload_file">upload</v-btn>
<v-btn
bottom
...
...
@@ -184,6 +189,7 @@ import Axios from 'axios';
export default {
data() {
return {
uploadedfile:null,
foldername:'',
curfName:'',
folders: [],
...
...
@@ -191,12 +197,18 @@ import Axios from 'axios';
search:'',
id: '',
dialog:false,
search: '',
howMenu: false,
showMenu: false,
x: 0,
y: 0,
dialog2:false
dialog2:false,
detail : {
dataname: null,
date: null,
owner_id:null,
datasize:null,
datatype:null
}
}
},
async created(){
...
...
@@ -207,21 +219,26 @@ import Axios from 'axios';
}
console.log(curData);
const response = await folder(curData);
const {file_response} = await file(curData);
console.log(response.data);
console.log(file_response);
const file_response = await file(curData);
this.$store.commit('setFolder', response.data.folders);
this.$store.commit('setCur', response.data.cur);
this.$store.commit('setParent', response.data.parentPath);
this.folders = this.$store.getters.folderL;
this.$store.commit('setFile', file_response.data.files);
this.folders = this.$store.getters.folderL;
console.log(this.$store.getters.fileL);
this.files = this.$store.getters.fileL;
} catch (error) {
console.log("에러");
console.log(error
.response.data
);
console.log(error);
}
},
methods: {
handleFileUpload(){
this.uploadedfile= this.$refs.uploadedfile.files[0]
console.log(this.uploadedfile)
},
initFolderName(){
this.foldername = '';
},
...
...
@@ -325,26 +342,76 @@ import Axios from 'axios';
},
async upload_file(){
try{
const fileData={
file: this.files,
user_id: this.$store.state.id,
const formData = new FormData();
formData.append('file', this.uploadedfile);
formData.append('user_id', this.$store.state.id);
formData.append('cur', this.$store.state.cur);
const currentData={
id: this.$store.state.id,
cur: this.$store.state.cur
}
console.log(
file
Data)
const response = await uploadFile(f
ile
Data);
const filelist = await file(
fileData.user_id
);
console.log(
response.message
);
console.log(
current
Data)
const response = await uploadFile(f
orm
Data);
const filelist = await file(
currentData
);
console.log(
filelist.data.files
);
this.$store.commit('setFile', filelist.data.files);
this.files = this.$store.getters.fileL;
console.log(this.$store.getters.fileL);
this.files = this.$store.getters.fileL;;
}catch(error){
const fileData={
file: this.files,
user_id: this.$store.state.id,
console.log("에러");
console.log(error);
}
},
async delete_file(itemName){
try{
var itemlist = this.$store.getters.fileL;
console.log(itemlist)
console.log(itemName)
const currentData={
fileName : null,
user_id: null,
cur: this.$store.state.cur
}
console.log(fileData);
for(var i=0; i<itemlist.length; i++){
console.log(itemlist[i].file_name)
if(itemlist[i].file_name == itemName){
currentData.fileName = itemlist[i].file_name;
currentData.user_id = itemlist[i].user_id;
}
}
const filelistData={
id: currentData.user_id,
cur: currentData.cur
}
console.log(currentData)
const response = await deleteFile(currentData);
setTimeout(function(){}, 500);
const filelist = await file(filelistData);
console.log(filelist.data.files);
this.$store.commit('setFile', filelist.data.files);
console.log(this.$store.getters.fileL);
this.files = this.$store.getters.fileL;;
}catch(error){
console.log("에러");
console.log(error.reponse.err);
console.log(error);
}
},
async download_file(namedata){
try{
const currentData={
fileName : namedata,
id: this.$store.state.id,
cur: this.$store.state.cur
}
const result = await downloadFile(currentData);
console.log(result)
}catch(error){
console.log("에러");
console.log(error);
}
}
},
show (folderN, e) {
...
...
@@ -357,6 +424,6 @@ import Axios from 'axios';
this.showMenu = true
})
}
}
}
</script>
...
...
Please
register
or
login
to post a comment