Add 'Image Upload' Feature

Each user can upload image to the system. The images from different users where be separated.
This commit is contained in:
XD-DENG
2017-07-08 11:02:46 +08:00
parent dad7935b01
commit 0e73da4df9
10 changed files with 119 additions and 2 deletions

View File

@@ -13,6 +13,7 @@
<li>Integrating with Bootstrap</li>
<li>Interaction with Database (SQLite)</li>
<li>Invoking static resources</li>
<li>Upload files</li>
</ul>
<p>For more basic knowledge of Flask, you can refer to <a href="https://www.tutorialspoint.com/flask/">a tutorial on Tutorialspoint</a>.</p>

6
templates/page_413.html Normal file
View File

@@ -0,0 +1,6 @@
{% extends "layout.html" %}
{% block page_title %}Request if too big(413){% endblock %}
{% block body %}
{{ super() }}
Please check the file size you're uploading.
{% endblock %}

View File

@@ -43,4 +43,32 @@
</table>
{% endif %}
<hr>
<h3>Upload Image</h3>
<form method='post' action='/upload_image' enctype=multipart/form-data>
<p><input type=file name=file>
<input type=submit value=Upload>
</form>
{% if images %}
<h3>Your Images</h3>
<table class="table small">
<thead>
<tr>
<th>Image ID</th>
<th>Timestamp</th>
<th>Image Name</th>
</tr>
</thead>
{% for image_id, timestamp, image_name in images %}
<tr>
<td> {{ image_id }} </td>
<td> {{ timestamp }} </td>
<td> {{ image_name }} </td>
</tr>
{% endfor %}
</table>
{% endif %}
{% endblock %}