Empire of Sports Europe
▓░░▓░░░▓░░▓▓▓░▓░░░▓▓▓░▓▓▓▓▓░░▓▓░░░▓▓░░▓▓▓░░░░░░
▓░▓░▓░░▓░░▓░░░▓░░░▓░░░▓░░░▓░░▓░▓░▓░▓░░▓░░░░░░░░
▓▓░░░▓░▓░░▓▓░░▓░░░▓░░░▓░░░▓░░▓░░▓░░▓░░▓▓▓░░░░░░
▓░░░░░▓▓░░▓░░░▓░░░▓░░░▓░░░▓░░▓░░░░░▓░░▓░░░░░░░░
▓░░░░░░▓░░▓▓▓░▓▓▓░▓▓▓░▓▓▓▓▓░░▓░░░░░▓░░▓▓▓░░░░░░
Hello and welcome to EOS-EU - First English Speaking Fansite of Empire of Sports!
Register to obtain full access to the website.
We hope you will enjoy the portal.

EOS-EU Team
Empire of Sports Europe
▓░░▓░░░▓░░▓▓▓░▓░░░▓▓▓░▓▓▓▓▓░░▓▓░░░▓▓░░▓▓▓░░░░░░
▓░▓░▓░░▓░░▓░░░▓░░░▓░░░▓░░░▓░░▓░▓░▓░▓░░▓░░░░░░░░
▓▓░░░▓░▓░░▓▓░░▓░░░▓░░░▓░░░▓░░▓░░▓░░▓░░▓▓▓░░░░░░
▓░░░░░▓▓░░▓░░░▓░░░▓░░░▓░░░▓░░▓░░░░░▓░░▓░░░░░░░░
▓░░░░░░▓░░▓▓▓░▓▓▓░▓▓▓░▓▓▓▓▓░░▓░░░░░▓░░▓▓▓░░░░░░
Hello and welcome to EOS-EU - First English Speaking Fansite of Empire of Sports!
Register to obtain full access to the website.
We hope you will enjoy the portal.

EOS-EU Team
Empire of Sports Europe
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Welcome to the first English Speaking Community FanSite of Empire of Sports :)
 
HomePortalGallerySearchLatest imagesHOMEPORTALFORUMLog inRegister

Share

1pɔɹɐsɥǝɹ


 

 Downloader

View previous topic View next topic Go down 
AuthorMessage
Jo_Oker
Administrator
Administrator
Jo_Oker


Downloader Empty
PostSubject: Downloader   Downloader EmptySun May 19, 2013 4:06 pm

download.php
Code:
<?php
if (isset($_GET['file']) && basename($_GET['file']) == $_GET['file']) {
    $filename = $_GET['file'];
} else {
    $filename = NULL;
}
$err = '<p style="color:#990000">Sorry, the file you are requesting is unavailable.</p>';
 if (!$filename) {
        echo $err;
    } else {
        $path = 'downloads/'.$filename;
        if (file_exists($path) && is_readable($path)) {
            $size = filesize($path);
            header('Content-Type: application/octet-stream');
            header('Content-Length: '.$size);
            header('Content-Disposition: attachment; filename='.$filename);
            header('Content-Transfer-Encoding: binary');
            $file = @ fopen($path, 'rb');
            if ($file) {
                fpassthru($file);
                exit;
            } else {
                echo $err;
            }
        } else {
            echo $err;
        }
    }
?>

index.php
Code:
<a href="download.php?file=untitled.png">Download file</a>

1Folder called:downloads
Back to top Go down
 

Downloader

View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Empire of Sports Europe :: PHP-