diff options
Diffstat (limited to 'web-static/upload.html')
-rw-r--r-- | web-static/upload.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/web-static/upload.html b/web-static/upload.html new file mode 100644 index 0000000..39cfa57 --- /dev/null +++ b/web-static/upload.html @@ -0,0 +1,69 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>rhimportd File Upload</title> + <style type="text/css"> + body { + background-color: #555; + } + + div.data { + background-color: white; + border: 1px solid; + padding: 1em; + font-family: monospace; + margin-top: 1em; + margin-bottom: 1em; + } + + td.label { + text-align: right; + } + </style> + <script src="jquery.min.js"></script> + <script type="text/javascript"> + function upload() { + $('#buttonupload').attr('disabled','disabled'); + + var cmdData = new FormData(); + cmdData.append("LOGIN_NAME", $('#username').val()); + cmdData.append("SESSION_ID", $('#sessionid').val()); + cmdData.append("FILENAME", $('#file').get(0).files[0]); + var command = { + type: "POST", + contentType: false, + processData: false, + data: cmdData, + dataType: 'json', + error: function(req, status, err) { result({StatusText: status, ErrorString: err}); }, + success: function(data, status, req) { result(data); } + }; + $.ajax('/public/upload', command); + + } + + function result(data) { + $('#result').text(JSON.stringify(data)); + $('#buttonupload').removeAttr('disabled','disabled'); + } + + function init() { + $('#sessionid').val(""); + result({}) + } + </script> + </head> + <body onload="init()"> + <div class="container"> + <h1>rhimportd File Upload</h1> + <table> + <tr><td class="label">Username</td><td><input id="username" type="text" size="20" value="heslinki" /></td></tr> + <tr><td class="label">Session</td><td><input id="sessionid" type="text" size="45" /></td></tr> + <tr><td class="label">File</td><td><input id="file" type="file" /></td></tr> + <tr><td> </td><td><button id="buttonupload" onclick="upload()">upload</button></td></tr> + </table> + <div id="result" class="data"></div> + </div> + </body> +</html> |