How can I change the root folder of my mPDF Output()
?
I need a filename that is taken from a variable and the file should be saved in my folder called "/files". The location for the file should be in a variable like $location =("/location")
.
Now my output is generating in the root folder.
$sql=mysql_query("SELECT * FROM `client_details` ORDER BY `c_id` DESC LIMIT 1");
while($data = mysql_fetch_array($sql))
{
$name=$data['name'];
}
$name_p = $name."-estimation.pdf";
$mpdf->Output($name_p,'F');
$mpdf->Output("/absolute/path/to/directory/" . $name_p,'F');
or
$mpdf->Output("relative/path/to/directory/" . $name_p,'F');
$path = __DIR__.'/../../files/'; //til you're at the location of upload
/*
//you can use, will return false if incorrect path
die(realpath($path to make sure you are at the right level))
*/
//concatenate file path to your file name
$mpdf->Output($path.$name_p,'F');