diff options
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> |