Hi there,
I'm trying to enable people to download video clips, they range anywhere between 1 and 10mb.
I want them to be able to download the file, but I don't want them to be able to see where the file is coming from, so they can't access others by guessing the URL.
Unfortunately, I am unable to place the files out of the web root.
I am linking to a page that has this PHP:
<?
session_start();
if (!isset($_SESSION["username"])){
die ("You are not authed");
}
$image = $_GET["img"];
$imageA = explode("/", $image);
$image2 = "w3irdpl4c3/". $image;
// We'll be outputting a video for download
header("Content-type: application/octet-stream");
// It will be called whatever the file is called
header("Content-Disposition: attachment; filename=". $imageA[2] ."");
// The source
@readfile($image2);
?>
The w3irdpl4c3 is the hidden folder that isn't echoed to the screen, this is how I have it set up for images anyways.
The problem is, when I use readfile() it reads the entire movie, before throwing up the download prompt. This is a long time if the movie is over a meg.
Any ideas?
Thanks in advance,
Mike Pearce