File size: 3,694 Bytes
03c5873
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!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>