This commit is contained in:
aplikacje committed 2026-09-24 10:51:42 +02:00
1 parent 72ed8ef789
commit e42104c4fb
625 files changed
+66966

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zadanie 3</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<h1>Upload file by fetch, no form</h1>
<input type="file" name="wyslany_plik" id="wyslany_plik">
<button id="wyslij">upload</button>
<pre id="wiadomosc">Tu beda dane z powrotem</pre>
<script>
const przycisk = document.getElementById("wyslij")
przycisk.onclick = function () {
const fd = new FormData()
fd.append("wyslany_plik", document.getElementById("wyslany_plik").files[0])
const body = fd
fetch("/process_upload", { method: "post", body })
.then(response => response.json())
.then(function (data) {
const pre = document.getElementById("wiadomosc")
pre.innerHTML = JSON.stringify(data, null, 5)
})
.catch(err => console.error(err))
}
</script>
</body>
</html>