StatementCollector / index.html
Sahanabg's picture
Create index.html
03c5873 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>PDF Upload</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
body {
margin: 0;
height: 100vh;
font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
background: linear-gradient(135deg, #f5f7fa, #e4e7eb);
display: flex;
align-items: center;
justify-content: center;
}
.card {
background: #ffffff;
padding: 40px;
border-radius: 12px;
width: 100%;
max-width: 420px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
text-align: center;
}
h1 {
font-size: 22px;
margin-bottom: 10px;
color: #1f2933;
}
p {
font-size: 14px;
color: #616e7c;
margin-bottom: 30px;
}
input[type="file"] {
display: none;
}
.file-label {
display: block;
padding: 14px;
border: 2px dashed #cbd2d9;
border-radius: 8px;
cursor: pointer;
color: #52606d;
margin-bottom: 20px;
transition: border-color 0.2s ease;
}
.file-label:hover {
border-color: #7b8794;
}
button {
width: 100%;
padding: 12px;
background: #2563eb;
color: #ffffff;
border: none;
border-radius: 8px;
font-size: 15px;
cursor: pointer;
transition: background 0.2s ease;
}
button:hover {
background: #1d4ed8;
}
.status {
margin-top: 15px;
font-size: 14px;
}
.success {
color: #16a34a;
}
.error {
color: #dc2626;
}
</style>
</head>
<body>
<div class="card">
<h1>Upload PDF</h1>
<p>Select a PDF file to send to the automation</p>
<label class="file-label">
Choose PDF
<input type="file" id="pdfInput" accept="application/pdf" />
</label>
<button onclick="uploadPDF()">Send File</button>
<div id="status" class="status"></div>
</div>
<script>
const webhookUrl = "https://hook.make.com/YOUR_WEBHOOK_URL";
function uploadPDF() {
const input = document.getElementById("pdfInput");
const status = document.getElementById("status");
status.textContent = "";
status.className = "status";
if (!input.files.length) {
status.textContent = "Please select a PDF file.";
status.classList.add("error");
return;
}
const file = input.files[0];
if (file.type !== "application/pdf") {
status.textContent = "Only PDF files are allowed.";
status.classList.add("error");
return;
}
const formData = new FormData();
formData.append("file", file);
fetch(webhookUrl, {
method: "POST",
body: formData
})
.then(response => {
if (!response.ok) {
throw new Error("Upload failed");
}
status.textContent = "PDF sent successfully.";
status.classList.add("success");
input.value = "";
})
.catch(() => {
status.textContent = "Error sending the file. Please try again.";
status.classList.add("error");
});
}
</script>
</body>
</html>