No hay manera de que me coja el tamaño del archivo, os dejo el php que use, a ver si veis un error o me podeis hechar un cable!
PHP que acciona la descarga y el envio de email!
Código PHP:
<?php
session_start();
if(isset($_SESSION["variables_form"]) && isset($_SESSION["variables_form_dw"]) && isset($_REQUEST["so"]) && isset($_REQUEST["file"])){
$variables_form = $_SESSION["variables_form_dw"];
$variables_form["so"] = $_REQUEST["so"];
$_SESSION["variables_form_dw"] = $variables_form;
$name = stripslashes(strip_tags($variables_form["nombre"]))." ".stripslashes(strip_tags($variables_form["apellidos"]));
$apellidos = stripslashes(strip_tags($variables_form["apellidos"]));
$empresa = stripslashes(strip_tags($variables_form["empresa"]));
$telefono = stripslashes(strip_tags($variables_form["telefono"]));
$mail = stripslashes(strip_tags($variables_form["mail"]));
$npeces = stripslashes(strip_tags($variables_form["npces"]));
$producto = stripslashes(strip_tags($variables_form["producto"]));
$sistema = stripslashes(strip_tags($variables_form["so"]));
$ip .= "". $_SERVER['REMOTE_ADDR'] ."";
$headers_fromUser = "From: ".$name."\r\n";
$headers_fromUser.= "Reply-To: ".$mail."\r\n";
$headers_fromUser.= "MIME-Version: 1.0\r\n";
$headers_fromUser.= "Content-Type: text/html; charset=UTF-8\r\n";
$message = "IP: ".$ip."<br /> Nombre: ".$name."<br />Apellidos: ".$apellidos."<br />Empresa: ".$empresa."<br />Teléfono: ".$telefono."<br />Email: ".$mail."<br />Nº PCs: ".$npeces."<br />Producto: ".$producto."<br />Sistema: ".$sistema;
$send = @mail("Totem Guard"." <[email protected]>\r\n","Descarga de software", $message, $headers_fromUser);
$url = $_REQUEST["file"];
$file = basename($url);
$size = filesize($path);
//decomentada la seguent linea
//$size = filesize($url);
$mime = array('application/octet-stream');
header('Content-Type: '.$mime);
header('Content-Disposition: attachment; filename="'.$file.'"');
header('Content-Transfer-Encoding: binary');
//header('Content-Length: '.sprintf('%d', $size));
header('Expires: 0');
// check for IE only headers
if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header('Pragma: no-cache');
}
readfile($url);
if (!$send) {
die();
}
}
else if(!isset($_REQUEST["producto_id"])){
$error_form = "Debe seguir todos los pasos para poder descargar el software. Debe volver a rellenar el <a href='http://www.xxx.com'>formulario</a>.";
}
?>
Gracias, Christian!