From c2bb74ac0096a03438d7eb4ab79ee4b5d5b7ddf0 Mon Sep 17 00:00:00 2001 From: Kyle K Date: Wed, 1 Mar 2017 00:33:22 -0600 Subject: implement and display a list of uploaded files - adds a /api/filenames RESTful API - adds a cute nyancat banner --- static/img/nyancat.gif | Bin 0 -> 22528 bytes static/index.html | 13 +++++++++++-- static/js/upload.js | 17 ++++++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 static/img/nyancat.gif (limited to 'static') diff --git a/static/img/nyancat.gif b/static/img/nyancat.gif new file mode 100644 index 0000000..fc230a1 Binary files /dev/null and b/static/img/nyancat.gif 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 @@ - + - Upload Example + fatalhalt file upload + +

Upload File

+ +
+

Uploaded Files

+ + +
+ 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("" + element + ""); + }); + } + xhr.send(); + } + uploadedFilenameList(); +}); + + -- cgit v1.2.3