Every search I do, I get slightly different descriptions of what headers are needed to do a file download. What I want is the ability for a person to backup an SQL database, and have it downloaded as a zipped file. I also want the Save As... dialog box to open up.
The following code works differently in different browsers.
$filename = "Participant-Backup".Date("Y-m-d").".sql.bz2";
$backup_string = "/usr/local/mysql/bin/mysqldump --user=Administrator --password=$_SESSION[userPass] --opt CnR | bzip2";
It was downloading correctly in Safari, but no dialog box. I rearranged some headers, and now it won't work at all in Safari. All I get a blank file with the right filename.
Firefox gets and saves the file, but names it backup.php, which is the name of the script. No dialog box.
Chrome works just fine.
IE. ugh. It fails, with a "cannot connect to server" error message.
Every search I do I get different ideas, and I have not been able to find much about what these headers are "supposed" to do. Any help to get this up and working would be appreciated.