I have an interesting question for ya'll. I want to create a sort of backup page for my website. What it will entail is to download a .tar.gz of everything in public_html/.. (the parent directory of my webroot). I don't want to have to run an exec() command to make the file, download it, then delete it. Rather, I want it to do all this in one step, sort of. I've seen it done, but I didn't get to see any of the code. Here's the overview of how i want it to flow:
- Go to backup page
- Click on the download now link
- User prompted to save a file with a name such as: "backup_2003-02-11.tar.gz". This file name dynamically created based on the current day.
- The file is saved on the user's computer and is not stored anywhere on the server. No deletion needed after the download is finished.
Would there be a way to redirect the output of tar | gz to the browser for download? Any help ya'll can give is greatly appreciated!