Ver Mensaje Individual
  #13 (permalink)  
Antiguo 12/11/2009, 16:16
Avatar de elsolodigno
elsolodigno
 
Fecha de Ingreso: agosto-2009
Mensajes: 225
Antigüedad: 14 años, 8 meses
Puntos: 2
Respuesta: Consulta sobre $name = $_FILES['attachment']...

disculpá mi ignorancia..., estoy dndo mis primeros pasos...

éste codigo a continuación está antes del form:

If($_POST['submit']==true) {
extract($_POST, EXTR_SKIP);

// Check the form for errors

If(trim($yourname)=="") {
$error.="You did not enter your name!<br />";
}

If(trim($youremail)=="") {
$error.="You did not enter your email!<br />";
} Elseif(!eregi("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}\$",$youremail)) {
$error.="Invalid email address.<br />";
}

If(trim($emailsubject)=="") {
$emailsubject=$defaultsubject;
}

If(trim($yourmessage)=="") {
$error.="You did not enter a message!<br />";
}

// Verify Attchment info

If($allowattach > 0) {

//Loopish

For($i=0; $i <= $allowattach-1; $i++) {

If($_FILES['attachment']['name'][$i]) {

$ext=get_ext($_FILES['attachment']['name'][$i]);
$size=$_FILES['attachment']['size'][$i];
$max_bytes=$max_file_size*1024;

//Check if the file type uploaded is a valid file type.

If(!in_array($ext, $allowtypes)) {

$error.= "Extensión inválida ".$_FILES['attachment']['name'][$i].", sólo ".$types." es permitido.<br />";

//Check the size of each file

} Elseif($size > $max_bytes) {
$error.= "Su archivo: ".$_FILES['attachment']['name'][$i]." es demasiado grande. Máximo permitido ".$max_file_size."kb.<br />";
}

} // If Files
$name=$_FILES['attachment']['name'][0];
} // For

Es acá donde agrego $name=$_FILES['attachment']['name'][0]; y en el from una varible para que llegue al email?. GRacias!.