I'm trying to send a zip file to the user.
$file_info = get_file_info($filepath_name);
header("Content-Type: " . get_mime_by_extension($filepath_name));
header("Content-Length: " . $file_info["size"]);
header_remove('Pragma');
header_remove('Cache-Control');
//header("Content-Type: application/force-download");
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.urlencode($filepath_name));
header('Location: file://'.$filepath_name);
readfile($filepath_name);
$filepath_name
is set to "D:\dev2.local\storage_users\1\export_data\course_2357.zip".
readfile()
returns the correct size of file but the file is still not served for downloading.
I've tried all the combinations of headers settings to no avail.