Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $filename = $_GET['file'];
- $ext = $_GET['type'];
- $filename .= '.' . $ext;
- $path = "../generatedReports/" . $filename;
- header('Content-type: application/vnd.ms-excel;');
- header('Content-Disposition: attachment; filename=' . $filename);
- header("Pragma: public");
- header("Expires: 0");
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
- header("Cache-Control: public", false);
- header("Content-Description: File Transfer");
- header("Accept-Ranges: bytes");
- header("Content-Transfer-Encoding: binary");
- header("Content-Length: " . filesize($path));
- $size = filesize($path);
- $f = fopen($path, 'r');
- $content = fread($f, $size);
- echo $content;
- echo unicode2utf8(hexdec("00CE")); // Result: Î
- // Or the function that will recognize U+ in front of string, and will skip it to show the character
- function unicodeCodePointToChar($str) {
- if (substr($str,0,2) != "U+") return $str;
- $str = substr($str,2); // Skip U+
- return unicode_to_utf8(array(hexdec($str)));
- }
- echo unicodeCodePointToChar("U+00CE"); // Result: Î
- $filename = $_GET['file'];
- $ext = $_GET['type'];
- $filename .= '.' . $ext;
- $path = "../generatedReports/" . $filename;
- header('Content-type: application/vnd.ms-excel;');
- header('Content-Disposition: attachment; filename=' . $filename);
- header("Pragma: public");
- header("Expires: 0");
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
- header("Cache-Control: public", false);
- header("Content-Description: File Transfer");
- header("Accept-Ranges: bytes");
- header("Content-Transfer-Encoding: binary");
- ob_clean(); // discard any data in the output buffer (if possible)
- flush(); // flush headers (if pos
- readfile($path);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement