'How Download File in php for Big Size

I should download Big file video with size 200mb in local pc drive.

The code is correct for medium size but fail with big size with return ERR_INVALID_RESPONSE.

I have tried also with readfile and file_get_contents method without succesfull.

My code php is:

<?php
Header("Content-type: application/octet-stream");
Header("Content-Disposition: attachment; filename=a.mp4");
Header("Content-Description: Download Manager");
header('Content-Transfer-Encoding: binary');
Header("Pragma: No-Cache");
Header("Expires: 0");
ob_clean();
$path="http://myurlexample/...../a.mp4"
$ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $path);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    if(curl_exec($ch) === FALSE) {
         echo "Error: " . curl_error($ch);
    } else {
         echo curl_exec($ch);
    }

    curl_close($ch);
flush();
exit();
?>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source