Bajar archivos

Javier
02 de Diciembre del 2003
Estoy tratando de bajar un archivo con PHP usando la funcion HEADER.
pongo lo siguiente:

header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
header("Content-Transfer-Encoding: binary");
header("Content-type: application/force-download");
header("Content-Disposition: attachment; filename=$archivo");
header("Content-Length: $size");

Pero siempre me baja el archivo mal, ocupando O bytes

que me está faltando??

Tino
02 de Diciembre del 2003
$file="tuarchivo.extension";
$size=filesize($file);

header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
header("Content-Transfer-Encoding: binary");
header("Content-type: application/force-download");
header("Content-Disposition: attachment; filename=$archivo");
header("Content-Length: $size");


Tino
02 de Diciembre del 2003
$archivo="patch del archivo";
$size=filesize($archivo);
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
header("Content-Transfer-Encoding: binary");
header("Content-type: application/force-download");
header("Content-Disposition: attachment;
header("Content-Length: $size");

readfile($archivo);