Ver Mensaje Individual
  #6 (permalink)  
Antiguo 18/08/2011, 15:50
Albesa
 
Fecha de Ingreso: agosto-2010
Ubicación: Tarragona
Mensajes: 10
Antigüedad: 13 años, 8 meses
Puntos: 0
Respuesta: no consigo enlazar mi correo i upload

Hola muy buenas
como puedo hacer para que mande el formulario i la imagen , formulario al correo, la imagen a la carpeta uploads.
Este es mi formulario
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML//EN">
<!-- saved from url=(0030)https://pdc.arsys.es/index.php -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script>
function isEmpty(str)
{
// Check whether string is empty.
for (var intLoop = 0; intLoop < str.length; intLoop++)
if (" " != str.charAt(intLoop))
return false;

return true;
}

function checkRequired(f)
{
var strError = "";
for (var intLoop = 0; intLoop < f.elements.length; intLoop++)
if (null!=f.elements[intLoop].getAttribute("required"))
if ((f.elements[intLoop].type == "checkbox" && !f.elements[intLoop].checked) || (f.elements[intLoop].type != "checkbox" && isEmpty(f.elements[intLoop].value)))
strError += " " + f.elements[intLoop].name + "\n";
if ("" != strError) {
alert("Los siguientes datos requeridos son necesarios:\n" + strError);
return false;
}
else
return true
}</script>

<title>Formulario</title>
<link href="../otro.css" rel="stylesheet" type="text/css">
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22779242-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
</head><body bgcolor="#FFFFFF" background="../images/3.jpg">
<div id="contenedor">
<form method="POST" action="http://cgi.contac.es/FormMail.pl" onSubmit="return checkRequired(this)">
<input type="hidden" name="recipient" value="[email protected]">
<input type="hidden" name="required" value="Email,">
<div class="stitulo">Noticias</div>
<div class="ssubtitulo">Periodicos - Blogs - Medios - Prensa - Articulos - Actualidad - Ultima hora - Pasado - Prostitutas - Hoy - Meretriz </div>
<p></p>
<center>
<table width="800" height="500" border="2" cellpadding="10" cellspacing="0">
<tbody>
<tr>
<td height="53">Email</td>
<td><input type="text" name="Email" size="80" required=""></td>
</tr>
<tr>
<td height="60">Zona</td>
<td><input type="text" name="Zona" size="80"></td>
</tr>
<tr>
<td>Anuncio</td>
<td><textarea name="Anuncio prensa" rows="15" cols="80"></textarea></td>
</tr>
</tbody>
</table>
</center>
<p></p>
<p></p>
<center>
<table>
<tbody>
<tr>
<td><input type="submit" name="Enviar" value="Enviar"></td>
<td><input type="reset" name="Restablecer" value="Restablecer"></td>
</tr>
</tbody>
</table>
</center>
<p align="center"><a href="../prensa.html">Volver</a></p>
</form>
</div>
</body></html>
luego index.php
<form action="upload.php" method="post" enctype="multipart/form-data">

<div align="center"><b>Enviar un nuevo archivo: </b>
<br>
<input name="userfile" type="file">
<br>
<input type="submit" value="Enviar">
</div>
</form>
I finalmente upload I su carpeta en el servidor con el nombre uploads
<?
// Configuración
$folder = "uploads/"; // Carpeta a la que queremos subir los archivos
$maxlimit = 5000000; // Máximo límite de tamaño (en bits)
$allowed_ext = "rar,jpg"; // Extensiones permitidas (usad una coma para separarlas)
$overwrite = "no"; // Permitir sobreescritura? (yes/no)

$match = "";
$filesize = $_FILES['userfile']['size']; // toma el tamaño del archivo
$filename = strtolower($_FILES['userfile']['name']); // toma el nombre del archivo y lo pasa a minúsculas


if(!$filename || $filename==""){ // mira si no se ha seleccionado ningún archivo
$error = "- Ningún archivo selecccionado para subir.<br>";
}elseif(file_exists($folder.$filename) && $overwrite=="no"){ // comprueba si el archivo existe ya
$error = "- El archivo <b>$filename</b> ya existe<br>";
}

// comprobar tamaño de archivo
if($filesize < 1){ // el archivo está vacío
$error .= "- Archivo vacío.<br>";
}elseif($filesize > $maxlimit){ // el archivo supera el máximo
$error .= "- Este archivo supera el máximo tamaño permitido.<br>";
}

$file_ext = preg_split("/\./",$filename); // aquí no tengo claro lo que hace xD
$allowed_ext = preg_split("/\,/",$allowed_ext); // ídem, algo con las extensiones
foreach($allowed_ext as $ext){
if($ext==$file_ext[1]) $match = "1"; // Permite el archivo
}

// Extensión no permitida
if(!$match){
$error .= "- Este tipo de archivo no está permitido: $filename<br>";
}

if($error){
print "Se ha producido el siguiente error al subir el archivo:<br> $error"; // Muestra los errores
}else{
if(move_uploaded_file($_FILES['userfile']['tmp_name'], $folder.$filename)){ // Finalmente sube el archivo
print "<b>$filename</b> se ha subido correctamente!"; //el mensaje que saldra cuando el archivo este subido
}else{
print "Error! Puede que el tamaño supere el máximo permitido por el servidor. Inténtelo de nuevo."; // Otro error
}
}
I con esto es todo no se como se puede organizar o poner ruta
confio en algún compañero me pueda ayudar
gracias a todos