Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --------------------REMOVE THIS----------------------------
- 1. kitchen compiles, user is redirected to download.php?id=buildid
- 2. ignore_user_abort means script will delete file even if user aborts download
- 3. download.php finds md5(buildid).zip
- (for security to stop people downloading files except if they have a md5 hash name of the buildid)
- 4. file is read in 1024 byte blocks and printed to output
- 5. if user aborts download, or we get to the end of file, script deletes the file
- --------------------REMOVE THIS----------------------------
- if(!isset($_GET['id'])){
- echo "build id is not set";
- exit();
- }
- $buildid = md5($_GET['id']);
- $buildfile = $buildid.".zip";
- $buildsize = filesize($buildfile);
- ignore_user_abort(true);
- if ($file = fopen($buildfile, 'rb')) {
- while(!feof($file) and (connection_status()==0)) {
- print(fread($file, 1024));
- flush();
- }
- }else{
- echo "build file does not exist";
- exit();
- }
- fclose($file);
- unlink($buildfile);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement