Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. $.post({
  2. url: 'upload.php', // point to server-side PHP script
  3. dataType: 'text', // what to expect back from the PHP script
  4. cache: false,
  5. contentType: false,
  6. processData: false,
  7. data: {action: 'enviar', form: form_data}, //quero passar assim, mais de um parametro, o form_data seria o file.
  8. type: 'post',
  9. success: function (response) {
  10. $('#msg').html(response); // display success response from the PHP script
  11. },
  12. error: function (response) {
  13. $('#msg').html(response); // display error response from the PHP script
  14. }
  15. });
  16. });
  17. });
  18. </script>
  19. </head>
  20. <body>
  21. <h1>Single File Upload Example using PHP</h1>
  22. <p id="msg"></p>
  23. <input type="file" id="file" name="file" />
  24. <button id="upload">Upload</button>
  25. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement