Guest User

Untitled

a guest
Oct 15th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. <div class="divAnexos">
  2. <label for="anexos" class="label">Anexos:</label> &nbsp;
  3. <input type="file" id="pegarAnexo" multiple>
  4. <textarea id="anexos"></textarea>
  5. <button id="addAnexos" class="ui-state-default"> Anexar </button>
  6. </div>
  7.  
  8. document.getElementById('addAnexos').onclick = function () {
  9. document.getElementById('pegarAnexo').click();
  10. };
  11. $('#pegarAnexo').change(function (event) {
  12. tmppath = URL.createObjectURL(event.target.files[0]);
  13. console.log(tmppath);
  14. $('#anexos').html($(this).val());
  15. });
  16.  
  17. function enviarEmail($aUser, $aPass, $aPort, $aDestinatario, $aHost, $aAssunto, $aCorpo, $aArquivos = '', $aCopia = '') {
  18.  
  19. $mail = new PHPMailer;
  20. $mail->isSMTP();
  21. $mail->CharSet = 'UTF-8';
  22. $mail->Host = $aHost;
  23. $mail->Port = $aPort;
  24. $mail->SMTPSecure = 'tls';
  25. $mail->SMTPAuth = true;
  26. $mail->Username = $aUser;
  27. $mail->Password = $aPass;
  28. $mail->setFrom($aUser);
  29. $mail->addAddress($aDestinatario);
  30. $mail->addAddress($aCopia);
  31. $mail->Subject = $aAssunto;
  32. $mail->Body = $aCorpo;
  33. $mail->addAttachment($aArquivos);
  34.  
  35. if (!$mail->send()) {
  36. return false;
  37. } else {
  38. return true;
  39. }
  40. }
  41.  
  42. <form id="myForm" action="comment.php" method="post">
  43. Name: <input type="text" name="name" />
  44. Comment: <textarea name="comment"></textarea>
  45. <input type="submit" value="Submit Comment" />
  46. </form>
  47.  
  48. <html>
  49. <head>
  50. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
  51. <script src="http://malsup.github.com/jquery.form.js"></script>
  52.  
  53. <script>
  54. // wait for the DOM to be loaded
  55. $(document).ready(function() {
  56. // bind 'myForm' and provide a simple callback function
  57. $('#myForm').ajaxForm(function() {
  58. alert("Thank you for your comment!");
  59. });
  60. });
  61. </script>
  62. </head>
  63.  
  64. $_FILES['file']['tmp_name']
  65.  
  66. $mail->AddAttachment($_FILES['seuArquivo']['tmp_name'],
  67. $_FILES['seuArquivo']['name']);
Add Comment
Please, Sign In to add comment