-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiscordautoupload.html
256 lines (233 loc) · 10.8 KB
/
discordautoupload.html
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload Media to Discord</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<style>
body {
font-family: 'Poppins', sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-size: cover;
background-position: center;
color: #fff;
}
.container {
background-color: rgba(0, 0, 0, 0.7);
padding: 30px;
border-radius: 10px;
width: 90%;
max-width: 500px;
text-align: center;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
backdrop-filter: blur(5px);
}
.notification {
margin-top: 10px;
padding: 10px;
background-color: #f04747;
border-radius: 5px;
display: none;
}
#successMessage {
background-color: #43b581;
color: #fff;
padding: 10px;
border-radius: 5px;
margin-top: 10px;
display: none;
}
form {
margin-top: 20px;
}
.file-input {
display: block;
margin-bottom: 10px;
color: #fff;
}
.upload-btn {
display: block;
width: 100%;
padding: 14px;
background-color: #5865f2;
color: #fff;
border: none;
border-radius: 6px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.upload-btn:hover {
background-color: #677bc4;
}
.status-message {
margin-top: 10px;
font-size: 16px;
color: #fff;
}
h2 {
font-size: 24px;
margin: 0 0 20px;
color: #fff;
}
footer {
text-align: center;
margin-top: 20px;
color: #fff;
}
footer .signature {
font-size: 14px;
margin-top: 10px;
}
.webhook-input {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 6px;
margin-bottom: 10px;
box-sizing: border-box;
font-size: 16px;
}
.images-container {
margin-top: 20px;
}
.image-wrapper {
display: inline-block;
margin: 5px;
max-width: 150px;
}
.image-wrapper img {
width: 100%;
border-radius: 5px;
}
</style>
</head>
<body style="background-image: url('')">
<div class="container">
<h2>Upload Media to Discord</h2>
<div class="notification" id="errorMessage"></div>
<div class="notification" id="successMessage">Media successfully uploaded</div>
<form id="discordUploader" enctype="multipart/form-data" method="post">
<input type="text" class="webhook-input" id="webhookUrl" name="webhookUrl" placeholder="Enter Webhook URL">
<input type="file" class="file-input" id="file" name="file" accept="image/png, image/jpeg, video/*" multiple>
<button type="submit" class="upload-btn">Upload</button>
<div class="status-message" id="statusMessage"></div>
</form>
<div class="images-container" id="imagesContainer"></div>
<footer>
<span class="signature">Made by Paavan</span>
</footer>
</div>
<script>
$(document).ready(function() {
var wallpapers = [
'https://images8.alphacoders.com/129/thumb-1920-1292972.jpg',
'https://r4.wallpaperflare.com/wallpaper/524/712/928/forza-forza-horizon-4-video-games-car-wallpaper-d8c65d883030ec3890fc713e886274fa.jpg',
'https://c4.wallpaperflare.com/wallpaper/556/480/912/forza-forza-horizon-4-video-games-screen-shot-wallpaper-preview.jpg',
'https://r4.wallpaperflare.com/wallpaper/337/703/669/nissan-gtr-r34-nismo-forza-horizon-4-car-wallpaper-49a0289db1faed1b16c7c8ffe081c6ed.jpg',
'https://r4.wallpaperflare.com/wallpaper/681/554/339/abstract-planet-space-purple-wallpaper-6970a84df14a9dbb16f7683f30a186ad.jpg',
'https://r4.wallpaperflare.com/wallpaper/649/484/984/photography-landscape-nature-mountains-wallpaper-c79d8611d8f43eda8fb79ffde6c12106.jpg',
'https://r4.wallpaperflare.com/wallpaper/464/322/337/mr-robot-tv-shows-artwork-4k-wallpaper-58561dd850103cc8c00c916e5832f4fa.jpg',
'https://r4.wallpaperflare.com/wallpaper/353/587/818/breaking-bad-heisenberg-walter-white-aaron-paul-wallpaper-e211d2905db6becbba6812c540186952.jpg',
'https://r4.wallpaperflare.com/wallpaper/1014/945/284/better-call-saul-breaking-bad-saul-goodman-googly-eyes-mirror-hd-wallpaper-19a038ddf10a4dab3697a84fc091269d.jpg',
'https://r4.wallpaperflare.com/wallpaper/506/46/546/walter-white-breaking-bad-desert-amc-wallpaper-d92018cde19a1dcb3697885f0021663d.jpg',
'https://r4.wallpaperflare.com/wallpaper/975/511/725/cyber-cyberpunk-cyberpunk-2077-car-futuristic-hd-wallpaper-d9d038ad71eadd6b9647d82ff011867d.jpg',
'https://r4.wallpaperflare.com/wallpaper/0/603/719/gta-vi-grand-theft-auto-grand-theft-auto-6-rockstar-games-hd-wallpaper-c8e63df8e090fc48a05c013e08d2843a.jpg',
'https://r4.wallpaperflare.com/wallpaper/440/479/655/rockstar-game-rockstar-games-red-dead-redemption-2-gang-hd-wallpaper-e900884db1ca3d9bf6a7b84fe0f136dd.jpg',
'https://r4.wallpaperflare.com/wallpaper/88/698/360/space-black-hole-interstellar-planet-wallpaper-7806ed3840100c9880ac114e1852449a.jpg',
'https://r4.wallpaperflare.com/wallpaper/683/186/563/macos-mojave-day-wallpaper-13a4fdadfc0811bfe145278604fcd852.jpg',
'https://r4.wallpaperflare.com/wallpaper/742/352/991/assetto-corsa-porsche-992-gt3-rs-video-game-car-racing-hd-wallpaper-eb360c8da3e1bf4905d4cbb9dd5c2c60.jpg',
'https://r4.wallpaperflare.com/wallpaper/187/931/815/city-game-sky-grand-theft-auto-v-gta-v-hd-wallpaper-2f8a14fb732812ed28a6fb7eb8c721e0.jpg'
];
$('body').css('background-image', 'url(' + wallpapers[Math.floor(Math.random() * wallpapers.length)] + ')');
$('#discordUploader').submit(function(e) {
e.preventDefault();
var files = $('#file')[0].files;
var webhookUrl = $('#webhookUrl').val();
if (!webhookUrl) {
$('#errorMessage').text("Please enter a Webhook URL.");
$('#errorMessage').show();
return;
}
if (files.length === 0) {
$('#errorMessage').text("Please select at least one file.");
$('#errorMessage').show();
} else {
$('#errorMessage').hide();
uploadFiles(files, webhookUrl); // Start upload process
setTimeout(function() {
if (!$('#successMessage').is(":visible")) {
$('#statusMessage').text("Please wait, it may look stuck.");
}
}, 8000);
}
});
function uploadFiles(files, webhookUrl) {
var totalSize = 0;
for (var i = 0; i < files.length; i++) {
totalSize += files[i].size;
}
var formData = new FormData();
for (var i = 0; i < files.length; i++) {
formData.append('file' + i, files[i]);
}
$('#statusMessage').text("Upload in progress..."); // Show message when upload starts
$.ajax({
type: 'POST',
url: webhookUrl,
data: formData,
processData: false,
contentType: false,
xhr: function() {
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) {
xhr.upload.addEventListener('progress', function(event) {
if (event.lengthComputable) {
var loaded = event.loaded;
var total = event.total;
var percent = Math.round((loaded / total) * 100);
var uploadedMB = (loaded / (1024 * 1024)).toFixed(2);
var totalMB = (total / (1024 * 1024)).toFixed(2);
$('#statusMessage').text("Upload in progress... " + percent + "% (" + uploadedMB + "MB/" + totalMB + "MB)");
}
}, false);
}
return xhr;
},
success: function() {
$('#discordUploader')[0].reset();
$('#successMessage').show();
$('#statusMessage').text("Upload successful");
displayImages(files);
},
error: function(xhr, status, error) {
console.error("Error uploading files:", error);
}
});
}
function displayImages(files) {
var imagesContainer = $('#imagesContainer');
imagesContainer.empty();
for (var i = 0; i < files.length; i++) {
var file = files[i];
var reader = new FileReader();
reader.onload = function(event) {
var imageSrc = event.target.result;
var imageWrapper = $('<div class="image-wrapper"></div>');
var image = $('<img src="' + imageSrc + '">');
imageWrapper.append(image);
imagesContainer.append(imageWrapper);
}
reader.readAsDataURL(file);
}
}
});
</script>
</body>
</html>