Ing_Amc, no se cómo utilizar eso... ¿cómo le hago?
En ver_archivos.php tengo la lista de archivos a descargar, los links son más o menos así:
<a href="download.php?file=../pictures/<?php echo $picture; ?>" target="_self">Descargar</a>
Y en download.php tengo el sig. código:
<?php
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($_GET["file"]));
header("Content-Disposition: filename=".basename($_GET["file"]));
?>
Pero los archivos se descargan con error! En las imágenes me dice "Vista previa no disponible", no puedo abrir los temas (.thm) y no puedo ver videos (.3gp). En pocas palabras, cualquier archivo que descargo se descarga con un peso de 0 KB!!
Con Internet Explorer ni siquiera la ventanita de descarga me aparece...
SOLUCIÓN Bueno Ing_Amc, aquí dejo una solución (funciona con Internet Explorer y Firefox):
Los links en ver_archivos.php deben ser algo así:
<a href="download.php?file=../pictures/hacker.gif" target="_self">Descargar</a>
El código de download.php debe ser:
<?php
header("Content-Disposition: attachment; filename=" . $_GET["file"]);
header("Content-Type: application/octet-stream");
header("Content-Length: " . filesize($_GET["file"]));
readfile($_GET["file"]);
?>
Por cierto, el orden de los header() no afecta, verdad?
Aún así, me gustaría que me explicaras cómo usar application/force-download, por favor. Gracias.