3 $stallAt = $_GET['stallAt'];
4 $stallFor = $_GET['stallFor'];
5 $mimeType = $_GET['mimeType'];
7 $file = fopen($name, "rb");
9 die("Cannot open file.");
11 header("Content-Type: " . $mimeType);
12 header("Content-Length: " . filesize($name));
14 if (isset($stallAt) && isset($stallFor)) {
15 $stallAt = (int)$stallAt;
16 if ($stallAt > filesize($name))
17 die("Incorrect value for stallAt.");
19 while ($written < $stallAt) {
21 if ($write > $stallAt - $written)
22 $write = $stallAt - $written;
24 echo(fread($file, $write));
29 usleep($stallFor * 1000000);
30 echo(fread($file, filesize($name) - $stallAt));
32 echo(fread($file, filesize($name)));