Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Write a PHP script to report the total download size of any URL.

user-image
Question added by Julfkar Moh Umar , Sr. Software Engineer , Aakash Edutech Private Limited
Date Posted: 2016/01/13
NOOR MOHAMMAD
by NOOR MOHAMMAD , Manager Operations , SHAAIER TOUR DEVELOPMENT

function downloadFile($file){// Set up the download system... header('Content-Description: File Transfer'); header('Content-Type: '.mime_content_type($file)); header('Content-Disposition: attachment; filename="'.basename($file).'"'); header('Content-Transfer-Encoding: binary'); header('Expires:0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: '.filesize($file));// Flush the cache ob_clean(); flush();// Send file to browser readfile($file);// DO NOT DO ANYTHING AFTER FILE DOWNLOADexit;}

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.