I Want to Make a Submission Form where you can Submit files Via a webhook
I have code But i am unsure What to do To Allow that to happen I have Researched this and Nothing is clear or is close to answering my Question due to it Being In Javascript i want to use Javascript Vanilla for this
here is the code i have so Far (FULL HTML PAGE SO YOU CAN FULL ANALYSE THE CODE):
> <!DOCTYPE html> > <html lang="en"> > <head> > <title>Redirect</title> > <meta charset="utf-8"> > <meta http-equiv="X-UA-Compatible" content="IE=edge"> > <meta name="viewport" content="width=device-width, initial-scale=1"> > <link rel="icon" href="https://cdn.discordapp.com/attachments/638677753662668801/696614301481435176/boofboat1.png"> > <h1> > Select files with HTML and JavaScript > </h1> > <input type="file" id="file-selector" multiple/> > <ul id="output"></ul> > > <button > type="submit" > class="btn" > onclick="upload()" > > > Upload file > </button> > <script> > const output = document.getElementById('output'); > if (window.FileList && window.File) { > document.getElementById('file-selector').addEventListener('change', event => { > output.innerHTML = ''; > for (const file of event.target.files) { > const li = document.createElement('li'); > const name = file.name ? file.name : 'NOT SUPPORTED'; > const type = file.type ? file.type : 'NOT SUPPORTED'; > const size = file.size ? file.size : 'NOT SUPPORTED'; > li.textContent = `name: ${name}, type: ${type}, size: ${size}`; > output.appendChild(li); > } > }); > } > </script> > > <script> > function upload() { > var request = new XMLHttpRequest(); > var file = document.getElementById("file-selector").files[0] > var filejson = JSON.stringify(file); > request.open( > "POST", > "MYWEBHOOKURL" > ); > > request.setRequestHeader("Content-type", "application/json"); > > var params = { > username: "File Upload", > content: > "Uploaded File", > > }; > request.send(JSON.stringify(params)); > } > </script> > <link rel="favicon" type="favicon" href="icon.png" /> > <meta > name="description" > content="Join Remux Giveaways By CLicking This Link They Hold Giveaway's And Stuff" > /> > <meta name="keywords" content="Boofboat,boofboat studios" /> > <meta name="robots" content="index, follow" /> > <meta name="language" content="English" /> > <meta name="revisit-after" content="1 days" /> > <meta > property="og:image" > content="https://cdn.discordapp.com/attachments/638677753662668801/696614301481435176/boofboat1.png" > /> > </head> > </html>
If there is a Very Clear guide on Doing it without Discord.js I Will happly have a look
At it But i do Prefer to have a Guide here (just whatever Works best for you)
And Yes i have Looked at the DOCS The Code was changed Because i Looked at the Docs
They have Not much on the file Section that i can Find
Thanks in advance