Ver Mensaje Individual
  #7 (permalink)  
Antiguo 10/11/2014, 13:49
lucastosellolatini
 
Fecha de Ingreso: noviembre-2012
Mensajes: 31
Antigüedad: 11 años, 5 meses
Puntos: 0
Respuesta: Formulario web con archivo adjunto

Código PHP:
Ver original
  1. <?
  2.     $asunto = "Ha llegado un CV";
  3.  
  4.     $header = 'From: ' . $mail . " \r\n";
  5.     $header .= "X-Mailer: PHP/" . phpversion() . " \r\n";
  6.     $header .= "Mime-Version: 1.0 \r\n";
  7.     $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
  8.     $header .= "This is a multi-part message in MIME format.\r\n";
  9.     $header .= "--".$uid."\r\n";
  10.     $header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
  11.     $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
  12.     $header .= $message."\r\n\r\n";
  13.     $header .= "--".$uid."\r\n";
  14.     $header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use different content types here
  15.     $header .= "Content-Transfer-Encoding: base64\r\n";
  16.     $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
  17.     $header .= $content."\r\n\r\n";
  18.     $header .= "--".$uid."--";
  19.  
  20.     $mensaje = "Alguien envió un curriculum vitae " . " \r\n";
  21.     $mensaje .= "Enviado el " . date('d/m/Y', time());
  22.  
  23.     $para = '[email protected]';
  24.  
  25.     // Tomas la informacion del archivo subido.
  26.     $partes_ruta = pathinfo($_FILES["file"]["name"]);
  27.      
  28.     // obtenemos el tamaño del archivo subido
  29.     $fsize = $_FILES["file"]["size"];
  30.      
  31.     if($partes_ruta['extension'] == "doc" or $partes_ruta['extension'] == "docx" or $partes_ruta['extension'] == "pdf" and $fsize <= 1501 )
  32.     {
  33.  
  34.         ini_set(sendmail_from, '[email protected]');
  35.         mail($para, $asunto, utf8_decode($mensaje), $header);
  36.  
  37.         echo header("Location: http://www.web.com.ar/contactok.php");
  38.  
  39.     }else {
  40.  
  41.     echo "ERROR";
  42.  
  43. }

Disculpa que siga molestando.... hice el codigo asi y siempre me lleva al else y aparece error.... me podrias decir donde me estoy equivocando?