허진호

Merge branch 'dev' of https://github.com/jh8579/fileshell_cloudcomputing into dev

# Conflicts:
#	fileshell/models.py
#	fileshell/settings.py
#	fileshell/urls.py
#	fileshell/views.py
#	templates/base.html
This diff is collapsed. Click to expand it.
body {
font-family: "Roboto", sans-serif;
}
.search_form{
float:right;
float:right;
}
.drop{
width:200px;
height:200px;
}
.drop_zone{
width:200px;
height:200px;
}
.left_bar {
float:left;
......
......@@ -26,11 +26,6 @@ class MediaStorage(S3Boto3Storage):
client.upload_fileobj(nf, AWS_STORAGE_BUCKET_NAME, user.username + '/' + dir + file.name)
os.remove('tempfile')
# putResponse = client.put_object(Bucket=AWS_STORAGE_BUCKET_NAME, Key= file_name)
"""
def download_file(file_name, dir):
client = boto3.resource('s3')
client.Bucket(AWS_STORAGE_BUCKET_NAME).download_file(Key= dir, Filename=LOCAL_DOWNLOAD_PATH+file_name)
"""
def down(filename, bucketPath):
session = boto3.session.Session(region_name='us-west-2')
......
......@@ -42,7 +42,6 @@ def file(request):
type = this_path.split('/')
type.pop(0)
type = type.pop(0)
print(type)
# user가 갖고 있는 폴더 중 현재 url을 parent로 갖는 폴더 필터링
folderList = Folder.objects.filter(parent__dir_name=dir, user=request.user.username)
......@@ -142,10 +141,10 @@ def add_folder(request):
def upload(request):
if request.method == 'POST':
print(request.FILES)
## 파일 model 변수 초기화
filedata = request.FILES.get('source-file')
title = request.FILES.get('source-file')
filedata = request.FILES.get('file') # request.Files['file'] 함수 썻을 때 오류 발생할 수 있음!!
title = request.FILES.get('file')
user = request.user
user_name = request.user.username
now = time.localtime()
......@@ -163,7 +162,6 @@ def upload(request):
MediaStorage.upload_file(filedata, user, dir)
else:
pass
return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
def download(request, bucketPath, filename, dir):
......
......@@ -5,6 +5,7 @@
<meta charset="utf-8">
<title> FileShell</title>
<link rel="stylesheet" href="{% static 'css/layout_base.css' %}">
<link rel="stylesheet" href="{% static 'css/dropzone.css' %}">
</head>
<body>
......@@ -22,7 +23,7 @@
<a href="{% url 'logout' %}"> <img class = 'logout_icon' src= "{% static 'resources/logout.png' %}" width="50" height="50" align="right"/></a>
<a href="{% url 'profile' %}"> <img class = 'profile_icon' src= "{% static 'resources/profile.png' %}" width="50" height="50" align="right"/></a>
<div class="search_form">
<form id='search' action="" onsubmit="yourFunction()" method="post" enctype="multipart/form-data">{% csrf_token %}
<form id='search' action="" onsubmit="yourFunction()" method="post" enctype="multipart/form-data" >{% csrf_token %}
<input type="dir_name" name="dir_name" id="dir_name" required="required" placeholder="검색할 파일이나 폴더 이름">
<input type = "submit">
</form>
......
......@@ -4,10 +4,8 @@
<div>
<div class="right_bar">
<li class="nav-item1"><a href="" class="nav-link-right"> <img class = 'add_folder_icon' src= "{% static 'resources/upload.png' %}" width="30" height="30"/> 파일 업로드</a></li>
<form action={% url 'upload' %} method="post" enctype="multipart/form-data" novalidate>
{% csrf_token %}
<input type ="file" name = "source-file">
<form action={% url 'upload' %} method="post" enctype="multipart/form-data" novalidate>{% csrf_token %}
<input type ="file" name = "file">
<input type = "submit">
</form>
<li class="nav-item1"><a href="" class="nav-link-right"> <img class = 'add_folder_icon' src= "{% static 'resources/add_folder.png' %}" width="30" height="30"/> 새 폴더</a></li>
......@@ -63,12 +61,30 @@
{% else %}
<p>No File.</p>
{% endif %}
</table>
<form action="{% url 'upload' %}" id="dropzone" class="dropzone" method="post" enctype="multipart/form-data">{% csrf_token %}
<div class="fallback">
<input class="fall_back" name="source-file" type="file"/>
</div>
</form>
</div>
</div>
<!-- //container -->
</div>
<!-- //frame -->
{% endblock %}
<script src="{% static 'js/dropzone.js' %}"></script>
<script type="text/javascript">
Dropzone.options.dropzone = {
maxFilesize: 10, // Mb
init: function() {
this.on('success', function(){
if (this.getQueuedFiles().length == 0 && this.getUploadingFiles().length == 0) {
location.reload();
}
});
}
};
</script>
{% endblock %}
\ No newline at end of file
......
......@@ -6,10 +6,6 @@
<div class="container">
<!-- //nav -->
<div class="content">
<div class="well text-muted text-center" style="padding-top: 4rem; padding-bottom: 4rem;">
<span class="glyphicon glyphicon-arrow-down" style="font-size: 4rem;"></span>
<h3>Drop Photos Here to Upload</h3>
</div>
<h2>즐겨찾기</h2>
<table cellspacing=1 width=700 border=1>
<tr>
......