Idea: PHP side
Read File, while outputting the read to the browser
!--? php/** * Created by Phpstorm. * User:kung * date:15-10-21 * Time: Afternoon 8:00am */set_time_limit (0); Large files are timed out when the read content is not finished, resulting in incomplete download files. $fpath = & #39; the_file_path& #39;; $file _pathinfo = PathInfo ($fpath); $file _name = $file _pathinfo[& #39; basename& #39;];$ File_extension = $file _pathinfo[& #39; extension& #39;]; $handle = fopen ($fpath, "RB"); if (FALSE = = = $handle) exit ("Failed t o Open the File "), $filesize = FileSize ($fpath); Header (" CONTENT-TYPE:VIDEO/MPEG4 ");//More different file types Set header Output Type header (" Accept-ranges:bytes "), Header (" Accept-length: ". $filesize); header (" Content-disposition:attachment; Filename= ". $file _name); $contents = & #39; & #39;; while (!feof ($handle)) {$contents = Fread ($handle, 8192); Echo $contents; @ob_flush (); Release data from the PHP buffer to flush (); Send the released data to the browser}fclose ($handle); exit;
Above the introduction of PHP processing large file download, including the content of reading files, I hope that the PHP tutorial interested in a friend to help Help.