Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/06/2007, 09:32
SoundKitchen
 
Fecha de Ingreso: junio-2007
Mensajes: 4
Antigüedad: 16 años, 10 meses
Puntos: 0
Download.php y firefox!!

Buenas, soy nuevo en el foro.
Estoy desarrollando un gestor documental, y tengo un problema a la hora de descargar archivos (pdf, doc, xls, ppt....) El problema es que en Firefox 2.0 me aparece la ventana de descarga con el tipo de archivo, tamaño, etc, pero no esta habilitada la opcion "Aceptar", asi que no puede descargarse, abrirse, el archivo. En IE7 no hay ningun problema.

Gracias y salu2,
Alex

El codigo de download.php es el siguiente:

Cita:
<?php
$type_text = array("txt", "log");
$type_doc = "doc";
$type_image = array("jpg", "jpeg", "gif", "png", "bmp");

if (isset($_GET["file2dl"])) {

$file2dl = $_GET["file2dl"];


$path = pathinfo($file2dl);
$extension = strtolower(@$path["extension"]);

foreach ($type_text as $single_type) {
if ($single_type == $extension) {
header ("Content-Type: text/plain");
$done = 1;
}
}
if (!isset($done)) {
foreach ($type_image as $single_type) {
if ($single_type == $extension) {
header ("Content-Type: image/" . $extension);
$done = 1;
}
}
}
if (!isset($done)) {
if ($extension=="doc") {
header ("Content-Type: application/ms-word");
$done = 1;
}
}
if (!isset($done)) {
if ($extension=="xls") {
header ("Content-Type: application/vnd.ms-excel");
$done = 1;
}
}

if (!isset($done)) {
if ($extension=="pdf") {
header ("Content-Type: application/pdf");
$done = 1;
}
}
if (!isset($done)) {
if ($extension=="ppt") {
header ("Content-Type: application/vnd.ms-powerpoint");
$done = 1;
}
}
if (!isset($done)) {
header ("Content-Type: application/octet-stream");
}
$fileName = @$path["basename"] ;

if(file_exists($file2dl))
{

header("Cache-control: private");
header("Pragma: public");
header("Content-Transfer-Encoding: binary");
header('Content-Length: ' . filesize($file2dl));
header('Content-Disposition: attachment; filename=' . $fileName);
readfile($file2dl);
} else {

echo "aqui falla algo : " . $file2dl;
}



}

?>