Setting up files for download on my PHP site

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
frankpmjr
Forum Commoner
Posts: 26
Joined: Wed Sep 15, 2004 9:13 am

Setting up files for download on my PHP site

Post by frankpmjr »

Hi,

I can't seem to find how to code my pages to allow users to download files from my site. Please tell me where to find this information or what the code is. I have been looking through all of my PHP books and can't find it anywhere. It seems like it should be very simple but I am stumped, thanks for the help.
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post by MarK (CZ) »

You don't have to code anything, just put there a direct link to the file. If it fails, you probably have to set up correct rights to those files (so that they're accessible by users) with some FTP manager.
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

a little more

Post by phpScott »

for ex

Code: Select all

<a href="myfile.zip">my file dot zip</a>
the browser should be smart enough to realize that you want to download the files.
Of course it could depend a little on your server configuration but it shouldn't be an issue.

phpscott
frankpmjr
Forum Commoner
Posts: 26
Joined: Wed Sep 15, 2004 9:13 am

Post by frankpmjr »

Well don't I feel like an idiot. I can't believe it was that simple. I actually tried that but just realized that I misspelled the file name. Thank you very much, I appreciate it.
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

it happens to all of us

Post by phpScott »

It happens to all of us.
I just spent 15 mins trying to figure out why something wan't printing only to realize I had put the print statement after my return statement
do'h
Post Reply