Page 1 of 1

php download script

Posted: Mon Sep 08, 2003 2:20 am
by toms100
hi
im trying to make a php download script, but im not sure how i would go about stopping the browser downloading the file unless it has gone through the script. ill use .htaccess on the folder with the files, but how do i make php allow the user to download?

hope someone can help

Tom

Re: php download script

Posted: Mon Sep 08, 2003 10:04 am
by d-m
toms100 wrote:hi
im trying to make a php download script, but im not sure how i would go about stopping the browser downloading the file unless it has gone through the script. ill use .htaccess on the folder with the files, but how do i make php allow the user to download?

hope someone can help

Tom
If you make apache the autenticator using .htaccess ... The user only enters at these area if he is alowded . (Alowded to download the file I mean)

So you just make a page with a href to the file ... and the user download the file .

Other users that do not autenticate 'll not be able to get it... Apache .htaccess 'll do the job for U.


Other way that you can do it in php is having a user name and pass at a database, autenticate the user .. if the user have a download status at the database you include an a href to the file at your php file.

I hope that I could help U.

Posted: Mon Sep 08, 2003 3:26 pm
by toms100
thanks for the idea
in irc someone mentioned using readfile(), ill investigate that too:)