Salve a tutti stavo facendo un sistema di condivisione di video è per consentire di scaricare il video ho implementato tale codice
function readfile_chunked($filename,$retbytes=true) {
$chunksize = 1*(1024*1024); // how many bytes per chunk
$buffer = '';
$cnt =0;
$handle = fopen($filename, 'rb');
if ($handle === false) {
return false;
}
while (!feof($handle)) {
$buffer = fread($handle, $chunksize);
echo $buffer;
ob_flush();
flush();
if ($retbytes) {
$cnt += strlen($buffer);
}
}
$status = fclose($handle);
if ($retbytes && $status) {
return $cnt; // return num. bytes delivered like readfile() does.
}
return $status;
}
.
.
.
.
header("Content-Type: application/force-download");
header("Content-Type: application/download");
header("Content-type: Application/x-zip-compressed");
header("Content-Disposition: attachment; filename=$file");
header("Content-Length: $dimensioni_file");
Purtroppo questo codice avendo dei file di 900mb ad un certo punto si blocca...che voi sappiate c'è qualche spiegazione logica?? come posso fare??
provando a fare il download tramite ftp anche di explorer funziona tutto correttamente
Grazie