Update se_mes_im2.html
Browse files- se_mes_im2.html +43 -53
se_mes_im2.html
CHANGED
|
@@ -1,54 +1,44 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="en">
|
| 3 |
-
<head>
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
</head>
|
| 8 |
-
<body>
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
})
|
| 38 |
-
.then(data => {
|
| 39 |
-
if (data.urlFile) {
|
| 40 |
-
const newFilename = data.urlFile.split('/').pop();
|
| 41 |
-
document.getElementById('message').innerText = 'File uploaded successfully';
|
| 42 |
-
document.getElementById('newFilename').innerText = `New filename: ${newFilename}`;
|
| 43 |
-
} else {
|
| 44 |
-
document.getElementById('message').innerText = 'Failed to upload file';
|
| 45 |
-
}
|
| 46 |
-
})
|
| 47 |
-
.catch(error => {
|
| 48 |
-
console.error('Error:', error);
|
| 49 |
-
document.getElementById('message').innerText = 'Error: ' + error.message;
|
| 50 |
});
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Camera Image</title>
|
| 7 |
+
</head>
|
| 8 |
+
<body>
|
| 9 |
+
<h1>Upload Image</h1>
|
| 10 |
+
<form id="uploadForm" enctype="multipart/form-data" method="post" action="/upload">
|
| 11 |
+
<input type="file" name="photo">
|
| 12 |
+
<button type="submit">Upload</button>
|
| 13 |
+
</form>
|
| 14 |
+
<div id="message"></div>
|
| 15 |
+
<h1>Latest Image</h1>
|
| 16 |
+
<img id="cameraImage" src="/image" alt="Image" style="width:100%;">
|
| 17 |
+
<script>
|
| 18 |
+
document.getElementById('uploadForm').addEventListener('submit', function(event) {
|
| 19 |
+
event.preventDefault();
|
| 20 |
+
var formData = new FormData(this);
|
| 21 |
+
fetch('/upload', {
|
| 22 |
+
method: 'POST',
|
| 23 |
+
body: formData
|
| 24 |
+
})
|
| 25 |
+
.then(response => {
|
| 26 |
+
if (response.ok) {
|
| 27 |
+
return response.text();
|
| 28 |
+
}
|
| 29 |
+
throw new Error('Network response was not ok.');
|
| 30 |
+
})
|
| 31 |
+
.then(data => {
|
| 32 |
+
document.getElementById('message').innerText = data;
|
| 33 |
+
})
|
| 34 |
+
.catch(error => {
|
| 35 |
+
document.getElementById('message').innerText = 'Error: ' + error.message;
|
| 36 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
});
|
| 38 |
+
setInterval(function(){
|
| 39 |
+
var image = document.getElementById("cameraImage");
|
| 40 |
+
image.src = "/image?" + new Date().getTime();
|
| 41 |
+
}, 10000); // обновление каждые 10 секунд
|
| 42 |
+
</script>
|
| 43 |
+
</body>
|
| 44 |
+
</html>
|