Advertisement
memesbruh03

B64 Encoder

Apr 3rd, 2018
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.48 KB | None | 0 0
  1. <script>
  2. copier = {};
  3. function encodeFile(){
  4.     var filesSelected = document.getElementById("inputFileToLoad").files;
  5.     if (filesSelected.length > 0){
  6.         var fileToLoad = filesSelected[0];
  7.         var fileReader = new FileReader();
  8.         fileReader.onload = function(fileLoadedEvent) {
  9.             let src = fileLoadedEvent.target.result;
  10.             copier.src = src;
  11.             document.getElementById("result").innerHTML = src;
  12.         };
  13.     }
  14.     fileReader.readAsDataURL(fileToLoad);
  15. }
  16. (function styleInit() {
  17.     var head=document.getElementsByTagName('head')[0];
  18.         if (!head) {
  19.             return;
  20.         }
  21.     addGlobalStyle(`#styleSetting{padding: 0.2em; margin:0.2em;
  22.     position: absolute;bottom: 0;right:20px;width: 20%;
  23.     background-color: rgba(0,200,200,0.1);display:block;}
  24.     table{text-align: center; width: 100%; height: 80%;}
  25.     td{padding: 0px 0.3em;border: 1px solid black;}`);
  26.     function addGlobalStyle(css) {
  27.         style = document.createElement('style');
  28.         style.type = 'text/css';
  29.         style.innerHTML = css;
  30.         head.appendChild(style);
  31.     }
  32. })();
  33. </script>
  34.  
  35.  
  36. <center>
  37. <h2><i>B64 Encoder</i></h2>
  38. <input id="inputFileToLoad" type="file" onchange="encodeFile();" />
  39. <br><br><br>
  40. <textarea readonly id="result" rows="20" cols="50"></textarea>
  41. <br><br><br><br><p>made by memesbruh03 <img src="https://memesbruh03.neocities.org/files/images/main/demi.ico"></img></p>
  42. </center>
  43.  
  44.  
  45. <script>
  46. document.getElementById("inputFileToLoad").onchange=encodeFile;
  47. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement