Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="divAnexos">
- <label for="anexos" class="label">Anexos:</label>
- <input type="file" id="pegarAnexo" multiple>
- <textarea id="anexos"></textarea>
- <button id="addAnexos" class="ui-state-default"> Anexar </button>
- </div>
- document.getElementById('addAnexos').onclick = function () {
- document.getElementById('pegarAnexo').click();
- };
- $('#pegarAnexo').change(function (event) {
- tmppath = URL.createObjectURL(event.target.files[0]);
- console.log(tmppath);
- $('#anexos').html($(this).val());
- });
- function enviarEmail($aUser, $aPass, $aPort, $aDestinatario, $aHost, $aAssunto, $aCorpo, $aArquivos = '', $aCopia = '') {
- $mail = new PHPMailer;
- $mail->isSMTP();
- $mail->CharSet = 'UTF-8';
- $mail->Host = $aHost;
- $mail->Port = $aPort;
- $mail->SMTPSecure = 'tls';
- $mail->SMTPAuth = true;
- $mail->Username = $aUser;
- $mail->Password = $aPass;
- $mail->setFrom($aUser);
- $mail->addAddress($aDestinatario);
- $mail->addAddress($aCopia);
- $mail->Subject = $aAssunto;
- $mail->Body = $aCorpo;
- $mail->addAttachment($aArquivos);
- if (!$mail->send()) {
- return false;
- } else {
- return true;
- }
- }
- <form id="myForm" action="comment.php" method="post">
- Name: <input type="text" name="name" />
- Comment: <textarea name="comment"></textarea>
- <input type="submit" value="Submit Comment" />
- </form>
- <html>
- <head>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
- <script src="http://malsup.github.com/jquery.form.js"></script>
- <script>
- // wait for the DOM to be loaded
- $(document).ready(function() {
- // bind 'myForm' and provide a simple callback function
- $('#myForm').ajaxForm(function() {
- alert("Thank you for your comment!");
- });
- });
- </script>
- </head>
- $_FILES['file']['tmp_name']
- $mail->AddAttachment($_FILES['seuArquivo']['tmp_name'],
- $_FILES['seuArquivo']['name']);
Add Comment
Please, Sign In to add comment