Código:
file.php:<a href="file.php?do=<?php echo $ruta ?>">bajar</a>
Código PHP:
<?php
if(isset($_GET["do"])) {
$file = $_GET["do"];
$types = array('.php','.html');
$extension = strrchr($file, '.');
if(in_array($extension, $types)) {
return false;
} else {
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$file\"\n");
header("Content-Length: ".strlen($file)."\n\n");
$fp = fopen("$file", "r");
fpassthru($fp);
}
} else { return false; }
?>
El problema es en IE6... cuando le doy clic al link, guarda el archivo como "file" sin extensión alguna... me falta alguna cabecera? o necesito arreglar algo? , espero me puedan ayudar, gracias.