- $msg=DisplayMsg();
- if($msg)
- {
- try
- {
- $select = "SELECT * FROM `success-stories` where id='$id'";
- $result = $conn->query($select);
- $row = $result->fetch_assoc();
- $file=$row["download_pdf"];
- $file_arr=explode("/",$file);
- $path=$file_arr[0]."/".$file_arr[1]."/".$file_arr[2];
- if(file_exists($path))
- {
- header('Content-Description: File Transfer');
- header('Content-Type: application/pdf');
- header('Content-Disposition: attachment; filename="'.$path.'"');
- header('Expires: 0');
- header('Cache-Control: must-revalidate');
- header('Pragma: public');
- header('Content-Length: ' . filesize($path));
- ob_clean();
- ob_flush();
- readfile($path);
- }
- }
- catch(Exception $e) {
- echo 'Caught exception: ', $e->getMessage(), "\n";
- }
- }
Message is not displaying after downloading the file
- function DisplayMsg()
- {
- $val="";
- try{
- echo "
Thank you for downloading story
"; - }
- catch(Exception $e)
- {
- }
- return $val="success";
- }
- ?>

Mario ScheerenRank #1,371 · 1.2K reputationPosted Jun 7, 2020, 11:12 PM EDT