diff options
author | ache <ache@ache.one> | 2019-10-28 20:03:55 +0100 |
---|---|---|
committer | ache <ache@ache.one> | 2019-10-28 20:03:55 +0100 |
commit | b4e8eba34ca96d9298295eb9c01c1fc3d9036f3b (patch) | |
tree | 2d89cf0276ab80a2ac0fd43b957c203ff646ffc7 /test2.html | |
parent | New interface (diff) |
New version
Diffstat (limited to 'test2.html')
-rw-r--r-- | test2.html | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/test2.html b/test2.html deleted file mode 100644 index d68444d..0000000 --- a/test2.html +++ /dev/null @@ -1,36 +0,0 @@ -<html> -<head> -</head> -<body> - <label for="file_input">Select Files:</label> - <input id="fileinput" type="file"> -<script language="javascript"> - // Select your input type file and store it in a variable -const input = document.getElementById('fileinput'); - -// This will upload the file after having read it -const upload = (file) => { - fetch('http://localhost:8080/oups', { // Your POST endpoint - method: 'PUT', -// headers: { -// "Content-Type": "" -// }, - body: file // This is your file object - }).then( - response => response.json() // if the response is a JSON object - ).then( - success => console.log(success) // Handle the success response object - ).catch( - error => console.log(error) // Handle the error response object - ); -}; - -// Event handler executed when a file is selected -const onSelectFile = () => upload(input.files[0]); - -// Add a listener on your input -// It will be triggered when a file will be selected -input.addEventListener('change', onSelectFile, false); -</script> -</body> -</html> |