index.html 812 B

12345678910111213141516171819202122232425262728
  1. <form action="/upload" method="post" enctype="multipart/form-data" id='form'>
  2. <input type="file" name="photo" id='photo'/>
  3. </form>
  4. <script>
  5. photo.onchange = async () => {
  6. fetch('/upload', {
  7. method: "POST",
  8. headers: localStorage.authToken ? {Authorization: 'Bearer ' + localStorage.authToken} : {},
  9. body: new FormData(form)
  10. })
  11. }
  12. </script>
  13. <form action="/track" method="post" enctype="multipart/form-data" id='trackForm'>
  14. <input type="file" name="track" id='track'/>
  15. </form>
  16. <script>
  17. track.onchange = async () => {
  18. fetch('/track', {
  19. method: "POST",
  20. headers: localStorage.authToken ? {Authorization: 'Bearer ' + localStorage.authToken} : {},
  21. body: new FormData(trackForm)
  22. })
  23. }
  24. </script>