DmitrMakeev
commited on
Commit
•
5586a08
1
Parent(s):
f2e150a
Create upl_csv.html
Browse files- upl_csv.html +34 -0
upl_csv.html
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>CSV Upload</title>
|
7 |
+
</head>
|
8 |
+
<body>
|
9 |
+
<h1>Upload CSV File</h1>
|
10 |
+
<form id="uploadForm" enctype="multipart/form-data" method="post">
|
11 |
+
<input type="file" name="file" accept=".csv">
|
12 |
+
<input type="submit" value="Upload">
|
13 |
+
</form>
|
14 |
+
<div id="result"></div>
|
15 |
+
|
16 |
+
<script>
|
17 |
+
document.getElementById('uploadForm').addEventListener('submit', function(event) {
|
18 |
+
event.preventDefault();
|
19 |
+
const form = new FormData(this);
|
20 |
+
fetch('/upload_csv', {
|
21 |
+
method: 'POST',
|
22 |
+
body: form
|
23 |
+
})
|
24 |
+
.then(response => response.json())
|
25 |
+
.then(data => {
|
26 |
+
document.getElementById('result').innerText = JSON.stringify(data, null, 2);
|
27 |
+
})
|
28 |
+
.catch(error => {
|
29 |
+
console.error('Error:', error);
|
30 |
+
});
|
31 |
+
});
|
32 |
+
</script>
|
33 |
+
</body>
|
34 |
+
</html>
|