Tengo un problema que necesito resolver con inteligencia colectiva, sencillo es mi problema tengo un site que necesito descargar archivos segun ciertas condiciones, las condiciones se cumplern y estos deberian descargar los ficheros
aqui le dejo el archivo php par las descargas
Código PHP:
function Download($path, $speed = null)
{
//verificamos si es un afichero lo pasado al path
if (is_file($path) === true)
{
//limitmao el tiempo y lo colocamos a cero
set_time_limit(0);
while (ob_get_level() > 0)
{
ob_end_clean();
}
$speed = (is_null($speed) === true) ? filesize($path) : intval($speed) * 1024;
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize($path));
header('Content-Disposition: attachment; filename="' . basename($path) . '"');
header('Content-Transfer-Encoding: binary');
for ($i = 0; $i <= filesize($path); $i = $i + $speed)
{
echo file_get_contents($path, false, null, $i, $speed);
flush();
sleep(1);
}
exit();
}
return false;
}