Created
March 23, 2022 10:09
-
-
Save marcobehlerjetbrains/ccd1df86fdd0ae5193aa143c83e30e5d to your computer and use it in GitHub Desktop.
Spring Boot REF3 - upload.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
<h2>Photo Upload</h2> | |
<input id="fileupload" type="file" name="fileupload" /> | |
<button id="upload-button" onclick="uploadFile()"> Upload </button> | |
<script> | |
async function uploadFile() { | |
let formData = new FormData(); | |
formData.append("data", fileupload.files[0]); | |
await fetch('http://localhost:8080/photoz', { | |
method: "POST", | |
body: formData | |
}).then(result => result.text()) | |
.then(text => alert(text)); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment