PDA

View Full Version : simple PHP link to file


tpoynton
8-15-07, 09:14 PM
Greetings...

I'm trying to prevent direct access to some files, so I've got htaccess set up to block that, which means I need to get the files to the user via script...

SO, I've got my html page in a directory that parses html through the php processor. Is there an easy way to recode the html link to a link that, when clicked, the file is downloaded via PHP (perhaps through link, or symlink)?

The page before this is a form that must be filled out, which sets a session variable(?) that must be there to view the page. That works great; perhaps something can be added to that?

or, is there another way to do this? I've read that htaccess anti-leech methods dont work, or cause more problems than they solve...

THANKS!

BerksWebGuy
8-15-07, 09:18 PM
I use a modified version of this script: http://www.tips-scripts.com/download

tpoynton
8-15-07, 09:34 PM
That's funny - I use a modified version of that for the form processing, and am now working on setting it up to log my downloads as well as provide the file. I was initially hoping for something a little less involved, but it's not so bad - THANKS!

the only bugger is the 60 second timeout. my biggest file is 1.32mb, but in the past I still had people experience problems...

EDIT - all set now; it wasnt that bad. Now I'll wait for the occasional complaint from dial up users...

Tried to give you some rep points, but it wouldnt let me. I know it has been quite a while since I gave you points previously because I dont even remember...