post.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>paste</title>
  5. <meta charset="utf-8">
  6. <style>
  7. /*body, html { margin: 0; padding: 0; height: 100%; }*/
  8. #data { font-family: monospace; width: 100%; height: 85vh; top: 50px; right: 0; bottom: 0; left: 0; display: block; margin: 0; border: 1; resize: none; -moz-box-sizing: padding-box; -webkit-box-sizing: border-box; box-sizing: padding-box; padding: 8px; }
  9. #submit { position: absolute; top: 1ex; right: 1ex; font-size: 1.2em; }
  10. </style>
  11. </head>
  12. <body>
  13. <p><code>
  14. curl -T my_file.mp3 h45h.com
  15. </code>
  16. </p>
  17. <form action="." method="post">
  18. <textarea autofocus id="data" name="data"></textarea>
  19. <button accesskey="s" id="submit" type="submit">pa<u>s</u>te</button>
  20. </form>
  21. <script>
  22. document.getElementById("data").addEventListener("drop", function(event) {
  23. try {
  24. console.log(event);
  25. event.preventDefault();
  26. event.stopPropagation();
  27. var dt = event.dataTransfer;
  28. var files = dt.files;
  29. var reader = new FileReader();
  30. reader.addEventListener("loadend", function() {
  31. document.getElementById("data").value = reader.result;
  32. });
  33. console.log(files);
  34. console.log(reader);
  35. reader.readAsText(files[0]);
  36. } catch (e) {
  37. console.log(e);
  38. }
  39. }, false);
  40. document.getElementById("data").addEventListener("dragover", function(event) {
  41. event.stopPropagation();
  42. event.preventDefault();
  43. }, false);
  44. </script>
  45. </body>
  46. </html>