DmitrMakeev commited on
Commit
0de5455
1 Parent(s): c2ed1cd

Create se_mes_im2.html

Browse files
Files changed (1) hide show
  1. se_mes_im2.html +44 -0
se_mes_im2.html ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <!DOCTYPE html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Camera Image</title>
8
+ </head>
9
+ <body>
10
+ <h1>Upload Image</h1>
11
+ <form id="uploadForm" enctype="multipart/form-data" method="post" action="/upload">
12
+ <input type="file" name="photo">
13
+ <button type="submit">Upload</button>
14
+ </form>
15
+ <div id="message"></div>
16
+ <h1>Latest Image</h1>
17
+ <img id="cameraImage" src="/image" alt="Image" style="width:100%;">
18
+ <script>
19
+ document.getElementById('uploadForm').addEventListener('submit', function(event) {
20
+ event.preventDefault();
21
+ var formData = new FormData(this);
22
+ fetch('/upload', {
23
+ method: 'POST',
24
+ body: formData
25
+ })
26
+ .then(response => {
27
+ if (response.ok) {
28
+ return response.text();
29
+ }
30
+ throw new Error('Network response was not ok.');
31
+ })
32
+ .then(data => {
33
+ document.getElementById('message').innerText = data;
34
+ var image = document.getElementById("cameraImage");
35
+ image.src = "/image?" + new Date().getTime();
36
+ })
37
+ .catch(error => {
38
+ document.getElementById('message').innerText = 'Error: ' + error.message;
39
+ });
40
+ });
41
+ </script>
42
+ </body>
43
+ </html>
44
+