SHARE
TWEET

Untitled

a guest Aug 20th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top