Welcome Guest, Not a member yet? Register   Sign In
serving purchased files
#5

[eluser]infinivert[/eluser]
Nevermind, I think I figured it out:

Create a downloads (or whatever you want to call it) folder outside the web-root, and put your files in there. Then create a CI controller function that checks for whatever verification you want, then, if everything is good to go:

Code:
$this->load->helper('download');

$data = file_get_contents("../downloads/myfile.ext"); // Read the file's contents
$name = 'myfile.ext';
force_download($name, $data);

The verification process can check for a username / password or a verification code, whether or not the download is expired, etc., and keeping the actual file outside the web-root keeps the outside world from being able to get directly to the file.

There's probably more security that could / should be done, and I'm all ears if you guys have any suggestions.

Thanks again!

--Josh


Messages In This Thread
serving purchased files - by El Forum - 03-21-2009, 10:00 PM
serving purchased files - by El Forum - 03-21-2009, 10:22 PM
serving purchased files - by El Forum - 03-21-2009, 10:29 PM
serving purchased files - by El Forum - 03-21-2009, 10:50 PM
serving purchased files - by El Forum - 03-21-2009, 10:54 PM
serving purchased files - by El Forum - 03-21-2009, 10:54 PM
serving purchased files - by El Forum - 03-21-2009, 10:56 PM
serving purchased files - by El Forum - 03-22-2009, 12:16 AM
serving purchased files - by El Forum - 03-22-2009, 04:18 AM
serving purchased files - by El Forum - 03-22-2009, 06:23 AM
serving purchased files - by El Forum - 03-22-2009, 08:32 PM
serving purchased files - by El Forum - 03-22-2009, 09:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB