Hi,
I have this question, maybe a little stupid.
I want to run system command to make backup of databases. I force the browser to offer download box, but my problem is that system command will save the backup copy in the folder from where it is executed or other specified path.
Would appreciate any help with this, if i can just force download box and not save it some where else, or maybe keep it as an option.
Here is the code:
I’m not sure if there is any reasonable way to pipe the output of a system command directly to the php output buffer. But after sending the file to the browser just delete it from the server. No need to keep it around if you don’t want to.
Maybe i did not clearly ask the question, let me rephrase it.
Lets say my script is in /var/www/projects/ and i run the script to make backup, at the mean time when it ask for saving the file in other location through dialog box, it also backup a copy in /var/www/projects/ folder. Which i want to avoid to not save another copy, just the dialog box one.
I’m not sure I understand the problem. You can put whatever filename you want in:
header (“Content-Disposition: attachment; filename=$backupfile”);
And then use a completely different name/path when you generate the file on the server. Perhaps a random name in the tmp directory. Or perhaps I’m completely missing the question.