ob start - PHP multiple ob_start() and ob_end_clean() function not work -
i have index page :
<?php ob_start(); session_name('d12tyu'); @session_start(); ob_end_clean(); require abspath .'/config.php'; require abspath . '/class/backup.php'; ?> <!doctype html> <html> ....... html+<?php ?> code </html>
in backup class have code download backup file :
class db_backup { //other code public function download($file) { ob_start(); $filename = $this->dir . $file; $fp = fopen($filename, "rb"); header("pragma: public"); header("expires: 0"); header("cache-control: must-revalidate, post-check=0, pre-check=0"); header("cache-control: public"); header("content-description: file transfer"); header("content-type: application/octet-stream"); header("content-length: " . filesize($filename)); header("content-disposition: attachment;filename = " . $file . ""); ob_end_clean(); die(fpassthru($fp)); fclose($fp); } //other code }
now, when click in link(?action=options&mod=backup&do=download&id=db-backup.zip
) download file see this:
i cant download backup files. think problem ob_start();
, ob_end_clean();
. how can fix problem ?!
Comments
Post a Comment