How to change the file name when downloading?

The essence of the following. The server creates a file with a name report_12345.xlsx
Next, I turn to another file number 12345 is downloading the file.
$filename = 'report_'.$_GET['num'].'.xlsx';
 header('Content-Type: application/octet-stream');
 header('Content-Disposition: attachment; filename=' . basename( $filename));
 header('Expires: 0');
 header('Cache-Control: must-revalidate');
 header('Pragma: public');
 header('Content-Length:' . filesize( $filename));
readfile($filename);
//sleep(200);
 unlink($filename);

The file is downloaded and deleted from the server. Can I somehow change the name of the downloaded file report_12345.xlsx for example новое_имя.xlsx (so the downloaded file was called so)
March 23rd 20 at 19:26
1 answer
March 23rd 20 at 19:28
Solution
According to the HTTP standard, the line header('Content-Disposition: attachment; filename=any_file_name.xlsx'); informs the browser about the name of the file that is passed to it (any_file_name.xlsx).

Find more questions by tags PHP