Ver Mensaje Individual
  #4 (permalink)  
Antiguo 19/12/2013, 05:21
Lombardas
 
Fecha de Ingreso: marzo-2007
Mensajes: 7
Antigüedad: 17 años, 1 mes
Puntos: 0
Respuesta: Problema con adjunto en PhpMailer

ok, no se me enfaden.... Es que no sé cómo poner el código.... así que tendré que copy-paste

Procesador de datos en php:
Código:
<body>

	<?php
	
	
require("class.phpmailer.php");

extract($_POST);

$varname = $_FILES['archivo']['name'];
$vartemp = $_FILES['archivo']['tmp_name'];
$file = $_FILES['archivo'];
$mail = new PHPMailer();
$mail->Host = "localhost";	


echo $vartemp;
if($campo == "on")
{
	$trabCampo="SI";
}
else $trabCampo="NO";
if($almacen == "on")
{
	$trabAlm="SI";
}
else if($almacen == "") $trabAlm="NO";
if($alimSi == "true")
{
	$manipulador="SI";
} else
{
	$manipulador="NO";
}

if($vehSI == "true")
{
	$veh="SI";
} else
{
	$veh="NO";
}
$MailTo="[email protected]"; //<----------------- MAIL DE DESTINO
$dia=date("m.d.Y");
$hora=date("H:i:s");
$contenido="
El Mensaje SOLICITUD DE TRABAJO se Envio el  $dia a las $hora:\n\n
----------------------------Datos personales---------------------------------\n
Nombre $nombre\n                                                        //
dni: $dni\n    
Fecha nacimiento: $fnac\n
Dirección: $dire\n
población: $pobla\n
C.P: $cp\n
Provincia: $prov\n
movil: $movil\n
Teléfono fijo: $fijo\n
---------------------------Datos de trabajo------------------------------------\n
Campo: $trabCampo\n   experiencia: $exp_campo\n
Almacén: $trabAlm  experiencia: $exp_almacen\n
Carnet manipulador de alimentos: $manipulador   año expedición: $expedicion\n

Vehículo propio: $veh

---------------------Otras Indicaciones------------------------------------------\n
$Indicaciones\n




";

$mail->From = "[email protected]";
$mail->FromName = "WEB Fresgarrido.es";
$mail->Subject = "Solicitud de Trabajo (de $nombre)";
$mail->AddAddress($MailTo);
if ($varname != "") {

$mail->AddAttachment($vartemp, $varname);
}
$body = $contenido;

$mail->Body = nl2br($body);
$mail->IsHTML(true);
//$mail->Send();
if($mail->Send()){
    echo 'ok';
}else{
    echo 'Fail';
}

$trabCampo="";
$trabAlm="";
$veh="";


?>
</body>
Form básico (que sí funciona)
Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Solicitud de Trabajo</title>
</head>

<body background="fondo7.gif">

<form method="post" action="envia_datos2.php" enctype="multipart/form-data">
Nombre : <input type="text" name="nombre"><br>
Apellido : <input type="text" name="dni"><br>
Adjunto : <input type="file" name="archivo">
<br>
<br><br>
<input type="submit" name="valider" value="Enviar">
</form> 


</body>
</html>
Form complejo
Código:
<html>
<head>

<title>Solicitud de Trabajo - Fres Garrido, S.L. - Productores y comercializadores de fresas de Huelva</title>
<link rel="shortcut icon" href="http://www.fresgarrido.es/favicon.png">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<!-- Save for Web Styles (Sin título-1) -->
<style type="text/css">
<!--

#Tabla_01 {
	position:absolute;
	left:0px;
	top:0px;
	/*width:1677px;
	height:1300px;*/
}

a img, table{
        border:0px;
}

#index2-01 {
	position:absolute;
	left:0px;
	top:0px;
	width:162px;
	height:377px;
}

#Sinx20txedtulo-1-02 {
	position:absolute;
	left:162px;
	top:0px;
	width:1000px;
	height:10px;
}

#index2-03 {
	position:absolute;
	left:1162px;
	top:0px;
	width:224px;
	height:1066px;
}

#index2-04 {
	position:absolute;
	left:1386px;
	top:0px;
	width:291px;
	height:982px;
}

#Sinx20txedtulo-1-04 {
	position:absolute;
	left:162px;
	top:10px;
	width:1000px;
	height:900px;
	background-image:url(images/base1flash.gif);
}

    textarea {
        resize: none;
    }

H1 {
	font-family: Verdana;
	font-style: bold;
	font-weight: normal;
	color: #02570A;
	
	font-size: 60px;
	
	
	text-align: center;
	letter-spacing: 0px;
}
P {
	font-family: Verdana;
	font-style: normal;
	font-weight: normal;
	color: #666666;
	display: block;
	font-size: 12px;
	margin-bottom: 10px;
	line-height: 18px;
	text-align: left;
	letter-spacing: 0.2px;
}

#Cont {
	position:absolute;
	left: 170px;
	top:70px;
}

#index2-06 {
	position:absolute;
	left:0px;
	top:377px;
	width:162px;
	height:558px;
	background-image:url(images/index2_06.png);
}

#index2-07 {
	position:absolute;
	left:162px;
	top:910px;
	width:1000px;
	height:72px;
	background-image:url(images/index2_07.png);
}

#index2-08 {
	position:absolute;
	left:0px;
	top:935px;
	width:162px;
	height:47px;
}

#index2-09 {
	position:absolute;
	left:0px;
	top:982px;
	width:1162px;
	height:84px;
}

#index2-10 {
	position:absolute;
	left:1386px;
	top:982px;
	width:291px;
	height:84px;
}

#index2-11 {
	position:absolute;
	left:0px;
	top:1066px;
	width:1677px;
	height:234px;
}

-->
</style>
<!-- End Save for Web Styles -->
</head>
<body style="background-color:#FFFFFF; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;">

<!-- Save for Web Slices (Sin título-1) -->
<div id="Tabla_01">
	<div id="index2-01">
		<img src="images/index2_01.png" width="162" height="377" alt="">
	</div>
	<div id="Sinx20txedtulo-1-02">
		<img src="images/Sin-t&#xed;tulo-1_02.png" width="1000" height="10" alt="">
	</div>
	<div id="index2-03">
		<img src="images/index2_03.png" width="224" height="1066" alt="">
	</div>
	<!--<div id="index2-04">
		<img src="images/index2_04.png" width="291" height="982" alt="">
	</div>-->
  <div id="Sinx20txedtulo-1-04">
  <div id="Cont">
  <h1>Solicitud de trabajo</h1>
  <form method="post" action="envia_datos2.php" enctype="multipart/form-data">
  <p>Nombre Completo: <input name="nombre" type="text" size="50">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DNI: <input name="dni" type="text"></p>
  
  <!--/*Depuración*/-->
  <!--<p>Adjuntar tu foto o CV:<br>
  <input type="file" name"archivo"></p>
  <input type="submit" name="valider" value="Enviar"></p>
  </form>-->
  
  <p>Fecha de Nacimiento: <input name="fnac" type="text"></p>
  <p>Adjuntar tu foto o CV:<br>
  <input type="file" name"archivo"></p>
  <p>Dirección: <input name="dire" type="text" size="50"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Población: <input name="pobla" type="text"></p>
  <p>C. Postal: <input name="cp" type="text"></p>
  <p>Provincia: <input name="prov" type="text"></p>
  <p>Movil: <input name="movil" type="text"></p>
  <p>Tlf: <input name="fijo" type="text"></p>
  <tr>
  <p>Datos de Trabajo</p>
  <p>Campo: <input name="campo"  type="checkbox">    Años de Experiencia: <input name="exp_campo" type="text" size="4"></p>
  <p>Almacén: <input name="almacen" type="checkbox">     Años de Experiencia: <input name="exp_almacen" type="text" size="4">&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;Carnet manipulador de alimentos: &nbsp; &nbsp;
  SI <input type="radio" name="alimSi" value="true"> &nbsp; &nbsp; NO <input type="radio" name="AlimSi" value="false">&nbsp;Año Expedición: <input type="text" name="expedicion" size="4"></p>
  
  <p>Vehículo propio: &nbsp; &nbsp;
  SI <input type="radio" name="vehSI" value="true"> &nbsp; &nbsp; &nbsp; NO <input type="radio" name="vehSI" value="false"></p>
  <p>Observaciones:<br> <textarea  name="Indicaciones" cols="70" rows="4" resize="none"> </textarea></p> 
  
  <p align="center">&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<input type="submit" name="valider" value="Enviar"></p>
  </form>
  
  
  
  
  
  </div>
  </div>
	<div id="index2-06">
		
		<p><font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">El Tiempo en:<br>Palos de La Frontera
		<div id="TT_RBD1k1EkkprG4FIKKfujzzzjzWlKMKr2bdEtEZiIq1joGoGoG"><h2><a href="http://www.tutiempo.net">Clima en el mundo</a></h2><a href="http://www.tutiempo.net/Tiempo-Palos-de-la-Frontera-E21540.html">El tiempo en Palos de la Frontera</a></div>
<script type="text/javascript" src="http://www.tutiempo.net/widget/eltiempo_RBD1k1EkkprG4FIKKfujzzzjzWlKMKr2bdEtEZiIq1joGoGoG"></script>
	</div>
	<div id="index2-07">
		<a href="http://www.lafresaenelcorazon.es" target="_blank">
			<img src="images/bannerlfc.png" align="absmiddle">
		</a>
		<a href="http://www.chksolutions.es" target="_blank">
			<img src="images/mediobanner.png" align="absmiddle">
		</a>
	</div>
	<div id="index2-08">
		<img src="images/index2_08.png" width="162" height="47" alt="">
	</div>
	<div id="index2-09">
		<img src="images/index2_09.png" width="1162" height="84" alt="">
	</div>
	<!--<div id="index2-10">
		<img src="images/index2_10.png" width="291" height="84" alt="">
	</div>
	<div id="index2-11">
		<img src="images/index2_11.png" width="1677" height="234" alt="">
	</div>-->
</div>
<!-- End Save for Web Slices -->
</body>
</html>
Muchas gracias y disculpen las molestias.