$value) { fwrite($fp,$value); } header("Content-type:application/pdf"); header('Content-Disposition: attachment; filename=' . $filename); readfile( $mytempFile); unlink($mytempFile); } else{ //echo $filename; header("Content-type:application/pdf"); header('Content-Disposition: attachment; filename=' . $filename); readfile( $file); //unlink($tmp); //echo ''; } ?>