Hello All!
I am having problems setting up a file download script.
The files are not in the public web tree for security reasons. I have tried the following:
$url = "/home/path/to/file/";
$total = $url . $files[$file];
header("Content-Disposition: attachment; filename=$files[$file]");
header("Content-Type: application/download; filename=$files[$file]");
header("Content-Description: File Description");
header("Content-Length: " . filesize("$total"));
readfile($total);
The "files" array is being read from a directory and the "file" is being passed when the user clicks on a link.
The download box comes up like it should, the only problem is after one clicks save there is an error message saying that the file source is invalid.
I have made sure the path is correct as well as debugging the script five or more times. Please help.