Powtóreczka
No files matched your search
@@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Wysyłanie</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Wysyłanie tekstu i obrazka</h1>
|
||||
|
||||
<div style="width: 500px; height: 500px; overflow: hidden; border: 1px solid black;" id="obrazek"></div>
|
||||
<div style="width: 500px; height: 500px; overflow: hidden; border: 1px solid black;" id="tekst"></div>
|
||||
|
||||
<input type="file" name="plik" id="plik">
|
||||
<button id="wyslij">Wyślij</button>
|
||||
|
||||
<script>
|
||||
const przycisk = document.getElementById("wyslij")
|
||||
|
||||
przycisk.onclick = function() {
|
||||
const fd = new FormData()
|
||||
|
||||
fd.append("file", document.getElementById("plik").files[0])
|
||||
|
||||
const body = fd
|
||||
|
||||
const options = {
|
||||
method: "POST",
|
||||
body: body
|
||||
}
|
||||
|
||||
fetch("/handleUpload", options)
|
||||
.then(function(response) {
|
||||
return response.json()
|
||||
})
|
||||
.then(function(data) {
|
||||
console.log(data.typ)
|
||||
|
||||
if(data.typ == "obrazek") {
|
||||
const obrazek = document.getElementById("obrazek")
|
||||
|
||||
obrazek.innerHTML = `<img src="${data.nazwa_pliku}">`
|
||||
} else if(data.typ == "tekst") {
|
||||
const tekst = document.getElementById("tekst")
|
||||
|
||||
tekst.innerText = data.tresc
|
||||
}
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 17 MiB |
|
After Width: | Height: | Size: 17 MiB |
|
After Width: | Height: | Size: 17 MiB |
@@ -0,0 +1 @@
|
||||
przykładowy tekst lorem ipsum i tak dalej
|
||||
|
After Width: | Height: | Size: 17 MiB |
@@ -0,0 +1 @@
|
||||
przykładowy tekst lorem ipsum i tak dalej
|
||||
|
After Width: | Height: | Size: 17 MiB |
|
After Width: | Height: | Size: 17 MiB |
@@ -0,0 +1 @@
|
||||
przykładowy tekst lorem ipsum i tak dalej
|
||||
|
After Width: | Height: | Size: 17 MiB |
@@ -0,0 +1 @@
|
||||
przykładowy tekst lorem ipsum i tak dalej
|
||||
|
After Width: | Height: | Size: 17 MiB |
|
After Width: | Height: | Size: 17 MiB |
@@ -0,0 +1 @@
|
||||
przykładowy tekst lorem ipsum i tak dalej
|
||||
|
After Width: | Height: | Size: 17 MiB |
@@ -0,0 +1 @@
|
||||
przykładowy tekst lorem ipsum i tak dalej
|
||||
|
After Width: | Height: | Size: 17 MiB |
@@ -0,0 +1 @@
|
||||
przykładowy tekst lorem ipsum i tak dalej
|
||||
|
After Width: | Height: | Size: 17 MiB |
|
After Width: | Height: | Size: 17 MiB |
@@ -0,0 +1 @@
|
||||
przykładowy tekst lorem ipsum i tak dalej
|
||||
@@ -0,0 +1 @@
|
||||
przykładowy tekst lorem ipsum i tak dalej
|
||||
|
After Width: | Height: | Size: 17 MiB |
|
After Width: | Height: | Size: 17 MiB |
@@ -0,0 +1 @@
|
||||
przykładowy tekst lorem ipsum i tak dalej
|
||||
|
After Width: | Height: | Size: 17 MiB |
|
After Width: | Height: | Size: 17 MiB |