Created
February 25, 2022 19:59
-
-
Save JackZielke/a161114254f988fe5a933c7356865029 to your computer and use it in GitHub Desktop.
Generate 128M file for download testing without using 128M of space
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); | |
header('Expires: '.gmdate('D, d M Y H:i:s', 0).' GMT'); | |
header('Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0, FALSE'); | |
header('Pragma: no-cache'); | |
header('Content-Disposition: attachment; filename="test.file"'); | |
header('Content-type: application/octet-stream'); | |
header('Content-Length: 134217728'); | |
flush(); | |
$s='0'; | |
// 128k block | |
for($i = 0 ; $i < 17 ; $i++) | |
{ | |
$s .= $s; | |
} | |
// 128M output | |
for($i = 0 ; $i < 1024 ; $i++) | |
{ | |
echo $s; | |
flush(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment