here is my code:
ob_start();
$mm_type="application/octet-stream";
$file = '../uploads/files/' . $filename;
header("Cache-Control: public, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: " . $mm_type);
header("Content-Length: " .(string)(filesize($file)) );
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary\n");
ob_end_clean();
readfile($file);
the script triggers the download but the file is not the right size. My file must be 17Mo, but i download a 64Kb file each time. I placed this line above my script:
$file = '../uploads/files/' . $filename;
echo "FileSize: " . filesize($file);
exit();
And it display 17566342, the right size.
This issue appear when i made a big mistake on plesk, i ran this command:
chown -R 10003:1003 /
All my system was down, i could repair it by update plesk and ran:
plesk repair fs
But since then, my download script doesn't work properly.
I checked rights, my uploads dir is 755, my files dir is set to 755 too, and the file is set on 644.