From d1c8a85308b90c0d66d4a37526fd020d6e1c63cc Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 6 Dec 2012 14:32:45 -0800 Subject: [PATCH] Make the permanode file upload onchange do something. Change-Id: I7e3ce0257906e733e8f81dd5a94b2eb34361bcc3 --- server/camlistored/ui/permanode.html | 2 +- server/camlistored/ui/permanode.js | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/server/camlistored/ui/permanode.html b/server/camlistored/ui/permanode.html index 878ae87e9..229a97c4a 100644 --- a/server/camlistored/ui/permanode.html +++ b/server/camlistored/ui/permanode.html @@ -81,7 +81,7 @@ -

+

or drag & drop files here


diff --git a/server/camlistored/ui/permanode.js b/server/camlistored/ui/permanode.js
index 94148a7fd..38f6d078d 100644
--- a/server/camlistored/ui/permanode.js
+++ b/server/camlistored/ui/permanode.js
@@ -247,11 +247,20 @@ function startFileUpload(file) {
 function onFileFormSubmit(e) {
     e.stopPropagation();
     e.preventDefault();
-    alert("TODO: upload");
+    handleFiles(document.getElementById("fileInput").files);
 }
 
+function $(id) { return document.getElementById(id) }
+
 function onFileInputChange(e) {
-    handleFiles(document.getElementById("fileInput").files);
+    var s = "";
+    var files = $("fileInput").files;
+    for (var i = 0; i < files.length; i++) {
+        var file = files[i];
+        s += "

" + file.name + "

"; + } + var fl = $("filelist"); + fl.innerHTML = s; } function setupFilesHandlers() {