0

I need to recive audio and images on my form !

I only know how to add in the html(i think i know *?) but have no idea how to add it to jquery or php ...

PS : Extra ... i wanna know how php send and attachment to the e-mail... the attachment is stored in my site ? or it goes directly to the e-mail ?

thanks in advance !

HTML :

<form id="contact1" method="post" >
    <fieldset>
        Name :
        <input name="name" type="text" id="name">

        E-mail :
        <input name="email" type="text" class="email">

        Mensagem :
        <textarea name="message" cols="45" rows="8" id="message"></textarea>

        Send a file:
        <input name="arquivo" type="file"> ??????????????

    </fieldset>
    <input type="submit" name="enviar" value="Enviar" /></font><br>
</form>

JS :

$("#contact1").submit(function(e){
  e.preventDefault();
  var name = $("#name").val();
  var email = $("#email").val();
  var text = $("#message").val();
  var dataString = 'name=' + name + '&email=' + email + '&text=' + text;

  if (name.length > 3){
    $.ajax({
    type: "POST",
    url: "/scripts/mailform1.php",
    data: dataString,
    success: function(){
      $('#form1ok').fadeIn(300);
    }
    });
  } else{
    $('#form1error').slideDown(200);
  }
  return false;
});

PHP :

<?php
if ( isset($_POST['email']) && isset($_POST['name']) && isset($_POST['text'])) {

  $test = "/(content-type|bcc:|cc:|to:)/i";
  foreach ( $_POST as $key => $val ) {
    if ( preg_match( $test, $val ) ) {
      exit;
    }
  }
  mail( "contact@x.com", "Partner Form: ".$_POST['name'], $_POST['text'], "From:" . $_POST['email'] );

}
?>
BrunoWB
  • 129
  • 1
  • 1
  • 15

0 Answers0