PHP

Avinash singh | 11:49 AM


//*************** Make File Downloadable*************************//




<?php
if(isset($_GET['file']))
{     $fullPath = 'downloads/'.$_GET['file'];
    if (file_exists($fullPath)) {      
        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Length: ' . filesize($fullPath));
        header('Content-Disposition: attachment; filename="' . basename($fullPath) . '"');

        readfile($fullPath);
        exit();
    }

    // if file is not available send 404
    header( $_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
    include('../404.html');
    exit();
}

?>




if you have any query regarding this code then you can either e-mail me or contact me

+91 8750749655
avikanak.bkr@gmail.com

Thank you.

Avinash Kumar Singh © 2013. All Rights Reserved | Powered by-Blogger