File tree Expand file tree Collapse file tree 1 file changed +22
-17
lines changed
Expand file tree Collapse file tree 1 file changed +22
-17
lines changed Original file line number Diff line number Diff line change 22
33@section (' content' )
44 @if (file_exists (base_path (' backups/updater-backups/' )) and is_dir (base_path (' backups/updater-backups/' )) )
5- <?php
6- $filename = $_SERVER [' QUERY_STRING' ];
7-
8- $filepath = base_path (' backups/updater-backups/' ) . $filename ;
9-
10- $strFile = file_get_contents ($filepath );
11-
12- header (" Content-type: application/force-download" );
13- header (' Content-Disposition: attachment; filename="' . $filename . ' "' );
14-
15- header (' Content-Length: ' . filesize ($filepath ));
16- echo $strFile ;
17- while (ob_get_level ()) {
18- ob_end_clean ();
5+ <?php
6+ $filename = $_SERVER [' QUERY_STRING' ];
7+ $filepath = base_path (' backups/updater-backups/' ) . $filename ;
8+
9+ if (file_exists ($filepath )) {
10+ header (" Content-type: application/octet-stream" );
11+ header (' Content-Disposition: attachment; filename="' . $filename . ' "' );
12+ header (' Content-Length: ' . filesize ($filepath ));
13+
14+ $file = fopen ($filepath , ' rb' );
15+ if ($file ) {
16+ while (! feof ($file )) {
17+ echo fread ($file , 8192 );
18+ ob_flush ();
19+ flush ();
20+ }
21+ fclose ($file );
1922 }
20- readfile ($filepath );
21- exit ;
22- ? >
23+ exit ;
24+ } else {
25+ echo ' File not found.' ;
26+ }
27+ ? >
2328 @endif
2429
2530@endsection
You can’t perform that action at this time.
0 commit comments