Tech Tangents:Sandbox: Difference between revisions

From Tech Tangents
Jump to navigation Jump to search
No edit summary
No edit summary
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
<html>
{{#ask: [[Doom II]]|?From Year}}
  <script>
    window.addEventListener("load", () => {
      let button = document.getElementById("tt-button");
      let fileInput = document.getElementById("tt-input");
     
 
      button.addEventListener("click", () => {
        const api = new mw.Api();
        let param = {
          filename: "File_1.jpg",
          format: "json",
          ignorewarnings: 1,
        };
 
        api
          .upload(fileInput, param)
          .done(function (data) {
            console.log(data.upload.filename + " has sucessfully uploaded.");
          })
          .fail(function (data) {
            console.log(data);
          });
      });
    });
  </script>
 
  <input type="file" id="tt-input"/>
  <input type="button" id="tt-button" value="Upload" />
</html>

Latest revision as of 15:32, 12 September 2024