Guest User

Untitled

a guest
Oct 27th, 2020
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. <input type="file" id="archivos">
  2. <button onclick="enviar()">Enviar</button>
  3.  
  4. <script>
  5. function enviar() {
  6.  
  7. var formData = new FormData()
  8. formData.append( 'archivos', document.getElementById('archivos').files[0] )
  9.  
  10. var ajax = new XMLHttpRequest()
  11. ajax.open('POST', 'destino.php')
  12. ajax.onreadystatechange = function(){
  13. if (ajax.readyState === 4) {
  14. document.write(ajax.response)
  15. }
  16. }
  17. ajax.send( formData )
  18.  
  19. }
  20. </script>
  21.  
  22. <form>
  23.  
  24. </form>
Add Comment
Please, Sign In to add comment