I have a php script that opens a download dialog to a file that is on the server. It works for the most part but if a file has an '&' in the filename, then when you try to open it on the client's computer it is corrupt. I tried different file types and xls, xlsx, and pdf have all been corrupt (that's all I've tried). Any ideas on how to fix this? The code is below.
header("Cache-control: private");
header("Content-Type: " . $oFile->getMimeType());
header("Content-Length: " . $oFile->getFileSize());
header("Content-Disposition: attachment; filename=" . $fileName);
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
EDIT: When I open the file in a text editor, either Notepad++ or Sublime Text, it shows no content in the file.