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

Si si, aparece como que carga el archivo, como que lo sube... y desp dice: esperando www.dominio.com.ar

mi codigo es el mismo que el tuyo, hasta copie el formulario para probar y me hace lo mismo. Probe con una cuenta del hosting y con otra de gmail y pasa lo mismo en las dos.


Código PHP:
Ver original
  1. <?php
  2. if ($_POST){
  3.    
  4. // Tomas la informacion del archivo subido.
  5. $partes_ruta = pathinfo($_FILES["filead"]["name"]);
  6.  
  7. // obtenemos el tamaño del archivo subido
  8. $fsize = $_FILES["filead"]["size"];
  9.  
  10. if($partes_ruta['extension'] == "doc" or $partes_ruta['extension'] == "docx" or $partes_ruta['extension'] == "pdf" and $fsize <= 1516165165 )
  11. {
  12.  
  13.     $num = md5(time());
  14.  
  15.     //MAIL BODY
  16.     $body = "
  17.    <html>
  18.    <head>
  19.    <title>Formulario Trabaja con nosotros</title>
  20.    </head>
  21.    <body style='background:#EEE; padding:30px;'>
  22.    <h2 style='color:#767676;'>Trabaja con nosotros</h2>";
  23.  
  24.     $body .= "
  25.    <strong style='color:#0090C6;'>Nombre: </strong>
  26.    <span style='color:#767676;'>" . $_POST["nombre"] . "</span>";
  27.  
  28.     $body .= "
  29.    <strong style='color:#0090C6;'>Apellidos: </strong>
  30.    <span style='color:#767676;'>" . $_POST["apellido"] . "</span>";
  31.  
  32.     $body .= "
  33.    <strong style='color:#0090C6;'>Email: </strong>
  34.    <span style='color:#767676;'>" . $_POST["email"] . "</span>";
  35.  
  36.     $body .= "
  37.    <strong style='color:#0090C6;'>Teléfono: </strong>
  38.    <span style='color:#767676;'>" . $_POST["telefono"] . "</span>";
  39.  
  40.     $body .= "</body></html>";
  41.  
  42.     $_name=$_FILES["filead"]["name"];
  43.     $_type=$_FILES["filead"]["type"];
  44.     $_size=$_FILES["filead"]["size"];
  45.     $_temp=$_FILES["filead"]["tmp_name"];
  46.  
  47.     if( strcmp($_name, "") ) //FILES EXISTS
  48.     {
  49.     $fp = fopen($_temp, "rb");
  50.     $file = fread($fp, $_size);
  51.     $file = chunk_split(base64_encode($file));
  52.  
  53.     // MULTI-HEADERS Content-Type: multipart/mixed and Boundary is mandatory.
  54.     $headers = "From: GME <[email protected]>\r\n"; // Modifica el mail de la web
  55.     $headers .= "MIME-Version: 1.0\r\n";
  56.     $headers .= "Content-Type: multipart/mixed; ";
  57.     $headers .= "boundary=".$num."\r\n";
  58.     $headers .= "--".$num."\n";
  59.  
  60.     // HTML HEADERS
  61.     $headers .= "Content-Type: text/html; charset=UTF-8\r\n";
  62.     $headers .= "Content-Transfer-Encoding: 8bit\r\n";
  63.     $headers .= "".$body."\n";
  64.     $headers .= "--".$num."\n";
  65.  
  66.     // FILES HEADERS
  67.     $headers .= "Content-Type:application/octet-stream ";
  68.     $headers .= "name=\"".$_name."\r\n";
  69.     $headers .= "Content-Transfer-Encoding: base64\r\n";
  70.     $headers .= "Content-Disposition: attachment; ";
  71.     $headers .= "filename=\"".$_name."\r\n\n";
  72.     $headers .= "".$file."\r\n";
  73.     $headers .= "--".$num."--";
  74.  
  75.     }else { //FILES NO EXISTS
  76.  
  77.     // HTML HEADERS
  78.     $headers = "From: GME \r\n";
  79.     $headers .= "MIME-Version: 1.0\r\n";
  80.     $headers .= "Content-Type: text/html; charset=UTF-8\r\n";
  81.     $headers .= "Content-Transfer-Encoding: 8bit\r\n";
  82.     }
  83.  
  84.     // SEND MAIL
  85.     mail("test@dominio", "WEB - Trabaja con nosotros" , $body, $headers); // --> Aqui se espesificaran los usuarios.
  86.     //mail("[email protected]", "WEB - Trabaja con nosotros" , "hola", "cabecera");
  87.  
  88.     echo "<div class='ok'>
  89.    <strong>El formulario se ha enviado correctamente.</strong></div>";
  90. } else {
  91.     print "El tipo de documento no es correcto, recuerde solo se permitern .doc - .docx - .pdf"; exit;
  92. }
  93. /*
  94. print $headers; echo "<br>";
  95. print "------------------------------------------------------ <br>";
  96. print $body; exit;*/
  97. }
  98. ?>


El email no llega ni a spam, porque es como que no va nunca ni al else que tira error ni a el if que confirma el envio... queda cargando la pagina sin irse de donde esta el formulario.


Te invito a que pruebes: http://wi141613.ferozo.com/test.html