summaryrefslogtreecommitdiffstats
path: root/static/js/upload.js
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/js/upload.js
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/js/upload.js')
-rw-r--r--static/js/upload.js17
1 files changed, 16 insertions, 1 deletions
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();
+});
+
+