0

I am using for the first time ifsnop/mysqldump-php to backup a mysql database. Works fine, does the job, including blob fields (the reason I went with it). By default it saves the dump file online as a txt\sql file in a given folder on the server. I need to save it locally and get thesave as window where I can choose the location on my computer.

The basic script I have is:

<?php

include_once('../myfolder/mysqldump-php-master/src/Ifsnop/Mysqldump/Mysqldump.php');
$dump = new Ifsnop\Mysqldump\Mysqldump('mysql:host=myhost';dbname=myname', 'myuser', 'mypassword');
$dump->start('mybackup.sql');

?>

I tried something like the code here below, that generated a downloadable file, but I can't seem to get the dump content into the variable $content and write it into the file.

<?php

header('Content-Type: application/octet-stream');   
header("Content-Transfer-Encoding: Binary"); 
header("Content-disposition: attachment; filename=\""mybackup.sql"\"");  
echo '$content'; exit;

?>
Fabio
  • 31
  • 3
  • 1
    Does this answer your question? [PHP - send file to user](https://stackoverflow.com/questions/2882472/php-send-file-to-user) – Chris Haas Apr 29 '21 at 15:18
  • One assumes this would be in the documentation for this package, if it were possible. – miken32 Apr 29 '21 at 15:21

0 Answers0