/* openpdf.php */
$filename = $_REQUEST['filename'];
$filename_array = explode(".", $filename);
$filename_Extn=end($filename_array);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
$filename_Extn_Upper=strtoupper($filename_Extn);
if ($filename_Extn_Upper=='ZIP' || $filename_Extn_Upper=='zip')
{
header("Content-Type: application/zip");
}elseif($filename_Extn_Upper=='PDF' || $filename_Extn_Upper=='pdf')
{
header("Content-Type: application/pdf");
//}elseif($filename_Extn_Upper='HTM')
}else
{
header("Content-Type: text/html");
}
header("Content-Disposition: attachment; filename=".basename($filename).";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
readfile("$filename");
?>
We can call the function in the following manner
Click here to download
Blogger templates
Blogger news
Blogroll
Archives
-
▼
2012
(231)
-
▼
November
(21)
- Introduction.
- PHP Variable Types
- free yahoo email hack software
- No title
- About iLearn24x7
- Installing MySQL 5.0.45
- ARRAYS RELATED LINKS IN PHP
- Php Mysql Web Expert: Database Connection Mysql
- Database Connection Mysql
- How to use port forwarding in VirtualBox 4 Windows...
- For importing mysql database from mysql schema file
- more about optimization
- Codeigniter Captcha Verification using session - A...
- How to enable mod_rewrite on Ubuntu
- Who is online
- PHP Download Confirm Popup window script
- Use ASP or PHP?
- Uso de Formularios en PHP
- 13 -08-2012PHP Developer RecruitmentWebperfection ...
- PHP Best Practices - 2 : Use <?php...?>
- Control Structures in PHP: DO-WHILE
-
▼
November
(21)