I'm trying to download .sql.bz2
file using php. But i am unable to do it.
My code is downloading file but file not opening. I want file location to be hidden from user.
I am using following code:
$folderroot = $_SERVER['DOCUMENT_ROOT'];
$fileurl = $folderroot."/dbname.sql.bz2";
$downloadfilename = generaterandomcharacters(10).".sql.bz2";
header("Content-Type: application/octet-stream");
header('Content-Disposition: attachment; filename=test.sql.bz2');
header('Pragma: no-cache');
readfile($fileurl);