-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
39 lines (37 loc) · 1.11 KB
/
index.html
File metadata and controls
39 lines (37 loc) · 1.11 KB
1
2
3
4
5
6
7
8
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
39
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>QRIS Decoder</title>
<link rel="stylesheet" href="/static/vercel.css">
</head>
<body>
<div class="container">
<h1>QRIS Decoder</h1>
<form id="form">
<input type="file" id="file" accept="image/*">
<button type="submit">Upload & Decode</button>
</form>
<pre id="result"></pre>
</div>
<script>
document.getElementById("form").addEventListener("submit", async (e) => {
e.preventDefault();
const file = document.getElementById("file").files[0];
if (!file) return alert("Pilih file QRIS dulu");
const reader = new FileReader();
reader.onload = async () => {
const base64 = reader.result;
const res = await fetch("/api/check", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ image: base64 })
});
const data = await res.json();
document.getElementById("result").textContent = JSON.stringify(data, null, 2);
};
reader.readAsDataURL(file);
});
</script>
</body>
</html>