Tag Archives: File

Download File Using Php

I added the code to download the file using php. When we apply this concept, dont need to give the file dirctory to user. <?php function downloadfile($filepath){ if(file_exists($filepath)){ // Change it based on file extension or type $type=”application/zip”; header(“Pragma: public”); header(“Content-Type: $type”); header(“Cache-Control: public”); header(“Content-Description: File Transfer”); header(“Content-Disposition: attachment;filename=\””.basename($filepath)); header(‘Content-Length: ‘.filesize($filepath)); header(“Content-Transfer-Encoding: binary”); header(“Expires: 0”); […]