I'm not sure whether this should go in here or the PHP section. Mod please feel free to move it.
I have a strange problem.
I've got a folder in my public_html directory that contains some zip files.
To block direct access to these files, I have placed a htaccess with this content
Deny from all
I then have a php script where users can download files. This script contains this code:
// Set headers
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=".basename($file)."");
header('Content-Length: ' . filesize($file)); // added this line as per suggestion
// Read the file from disk
The problem is, when I have the htaccess. The zip is only being downloaded partially. Without the htaccess it downloads fully. Any idea why this is happening?