I'm using this code to download a file:
if ($file_name) {
$file_url = $file_name;
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"" . $file_url . "\"");
ob_clean();
flush();
readfile($file_url);
}
It downloads small file properly but when file size is large then, for Image files (like .jpg) saying Invalid Image. And for .pdf it is says invalid format. I'm using CodeIgniter framework.
$file_name start with https://