I pass the file name to the download page.
ie somefile.xls
The download page adds back to the full directory path to the file name.
i.e. c: \ temp \ somefile.xls
The problem is that now setting the "Content-Disposition" header does not work. The name of the file that he wants to download is the full path to the file directory. those. c_temp_somefile
Can Content-Disposition handle the full path?
If possible, how can I get a script to load the file correctly?
Code:
$myad = $_GET['myad'];
$glob_string = realpath('/foldera/folderb/folderc'). DIRECTORY_SEPARATOR .$myad;
header('Content-Type: application/excel');
$headerstring = 'Content-Disposition: attachment; filename='.$glob_string;
header($headerstring);
readfile($myad);
UPDATED code (from answers):
$myad = $_GET['myad'];
$glob_string = realpath('/mit/mit_tm/mrl_bol'). DIRECTORY_SEPARATOR .$myad;
header('Content-Type: application/excel');
$headerstring = 'Content-Disposition: attachment; filename='.$myad;
header($headerstring);
readfile($glob_string);
source
share