summaryrefslogtreecommitdiffstats
path: root/static
diff options
context:
space:
mode:
authorKyle K <kylek389@gmail.com>2017-03-01 00:33:22 -0600
committerKyle K <kylek389@gmail.com>2017-03-01 00:48:26 -0600
commitc2bb74ac0096a03438d7eb4ab79ee4b5d5b7ddf0 (patch)
treeb986c76b848b8ce77f276d2be4e6cf5aac769a57 /static
parent2c93e51b32cb68d4d828648903408299b6dc7cc7 (diff)
downloadexpress-upload-c2bb74ac0096a03438d7eb4ab79ee4b5d5b7ddf0.tar.gz
express-upload-c2bb74ac0096a03438d7eb4ab79ee4b5d5b7ddf0.tar.bz2
express-upload-c2bb74ac0096a03438d7eb4ab79ee4b5d5b7ddf0.zip
implement and display a list of uploaded files
- adds a /api/filenames RESTful API - adds a cute nyancat banner
Diffstat (limited to 'static')
-rw-r--r--static/img/nyancat.gifbin0 -> 22528 bytes
-rw-r--r--static/index.html13
-rw-r--r--static/js/upload.js17
3 files changed, 27 insertions, 3 deletions
diff --git a/static/img/nyancat.gif b/static/img/nyancat.gif
new file mode 100644
index 0000000..fc230a1
--- /dev/null
+++ b/static/img/nyancat.gif
Binary files differ
diff --git a/static/index.html b/static/index.html
index d790e64..57d8ea0 100644
--- a/static/index.html
+++ b/static/index.html
@@ -1,6 +1,6 @@
-<html>
+<!DOCTYPE html>
<head>
- <title>Upload Example</title>
+ <title>fatalhalt file upload</title>
<style type="text/css" media="screen">
#progress {
width: 500px;
@@ -22,6 +22,8 @@
</style>
</head>
<body>
+<img src="./img/nyancat.gif" width="200px" height="140px" />
+<h1>Upload File</h1>
<form id="uploadForm"
enctype="multipart/form-data"
action="/api/upload"
@@ -35,6 +37,13 @@
<div id="bar"></div>
</div>
+
+<div id="uploadedlist" style="padding-top: 20px">
+ <h2>Uploaded Files</h2>
+ <span id="filenames">
+ </span>
+</div>
+
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="./js/upload.js"></script>
</body>
diff --git a/static/js/upload.js b/static/js/upload.js
index a8a0e5a..da60c13 100644
--- a/static/js/upload.js
+++ b/static/js/upload.js
@@ -49,4 +49,19 @@ $(function () {
function status(message) {
$('#status').text(message);
}
-}); \ No newline at end of file
+
+ function uploadedFilenameList() {
+ var xhr = new XMLHttpRequest();
+ xhr.open('get', '/api/filenames', true);
+ xhr.onload = function () {
+ var fnames = JSON.parse(xhr.response);
+ fnames.forEach(function (element) {
+ $("#filenames").append("<a href=\"./uploads/" + element + "\" style=\"display: block\">" + element + "</a>");
+ });
+ }
+ xhr.send();
+ }
+ uploadedFilenameList();
+});
+
+