php - start downloading of a generated file and then interrupt download -
does know how php generate , random file , start downloading few second, after interrupt download? need test upload/download scripts , need large files generated, interrupted on half way of download. going integrate test utility debug script.
this can start download of file, how can interrupt download after random amount of time?
header('content-type: application/csv'); header("content-length: " . filesize($newfile)); header('content-disposition: attachment; filename="' . $filename . '"'); echo $content; exit();
you may use bash script , save interrupter.sh
. run in background ./interrupter.sh &
#!/bin/sh while : /etc/init.d/networking stop sleep 3 /etc/init.d/networking start sleep 10 done
it interrupt download 3 seconds. may customize changing param sleep.
Comments
Post a Comment