Hola amigos, estoy intentando adjuntar una imagen a un formulario, pero la verdad no doy pie con bola.
Intente poniendo esto:
Código PHP:
Ver original<?php
$Archivo = $_FILES['Archivo']['tmp_name'];
$Archivo_name = "curriculum-".$_FILES['Archivo']['name'];
$mail-> AddAttachment($Archivo,$Archivo_name);
?>
<!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" lang="es" xml:lang="es">
<head>
</head>
<body>
<form method="post" action="mailer.php" id="commentForm" name="commentForm">
<fieldset>
<div>
<label for="Nombre">Nombre:<span class="obligatorio">*</span></label>
<input type="text" name="Nombre" id="Nombre" class="required" />
</div>
<div>
<label for="Pais">País:</label>
<input type="text" name="Pais" id="Pais" />
</div>
<div>
<label for="Email">Email:<span class="obligatorio">*</span></label>
<input type="text" name="Email" id="Email" class="required email" />
</div>
<div>
<label for="Archivo">Archivo:</label>
<input type="file" name="Archivo" id="Archivo" />
</div>
<div>
<label for="Asunto">Asunto:<span class="obligatorio">*</span></label>
<input type="text" name="Asunto" id="Asunto" class="required" />
</div>
<div>
<label for="Mensaje">Mensaje:</label>
<textarea name="Mensaje" id="Mensaje" rows="6" cols="20"></textarea><br />
</div>
<input type="submit" name="submit" value="Enviar" class="enviabtn" />
</fieldset>
</form>
</body>
</html>
y mi archivo mailes es el siguiente:
Código PHP:
Ver original<?PHP
$to = "xxxxxxx"; //
$subject = "xxxxxx";
$headers = "xxxxxx";
$forward = 0;
$location = "";
$date = date ("l, F jS, Y");
$msg = "$date at $time.\n\n";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n"; }
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n"; }
}
mail($to, $subject, $msg, $headers); if ($forward == 1) {
header ("Location:$location"); }
else {
//echo "Thank you for submitting our form. We will get back to you as soon as possible.";
}
?>
pero no anda ni para atras, me da este error:
Cita: Fatal error: Call to a member function on a non-object in /nfs/c06/h02/mnt/89312/domains/urbanchip.com/html/de-psd-a-html/index.php on line 4
si me pueden dar una mano, se los agradecería muchisimo!
unabrazo