note 102454 rejected from faq.using by danbrown

[email protected] Wed, 16 Feb 2011 05:56:14 -0800
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: p dot deshpande at optrasystems dot com 

----

I am not able to download zip file using php. Is there any solution to download zip file with its content. I can download but content is not showing.

my tried code:

if ((isset($file))&&(file_exists($dir.$file))) {
		header("Pragma: public");
		header("Expires: 0");
		header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
		header("Content-Description: File Transfer");
		header('Content-Disposition: attachment; filename="'.$dir.$file.'"');
		header("Content-Transfer-Encoding: Binary");
		header("Content-length: ".filesize($dir.$file));
		header("Content-Type: application/zip");
		header('Content-Disposition:attachment;filename="'.$file.'"');
		ob_clean();
		flush();
		readfile($dir.$file);
	}