PDA

View Full Version : How to make file download link in http


glc
5-2-03, 02:41 PM
Hi :D
how do I make a link (?) that when clicked on my webpage would download a file to the user?

You know, like the ones that you click and then there is this thing that pops up in windows that asks if you would like to save, open etc... and where on your HD?

Also is it okay that I placed the file to be downloaded in the new directory that I have created and named "download"?
So now there are:
cgi_bin directory
htdocs directory and
download directory.

OkRob
5-2-03, 02:59 PM
A link like <A HREF="http://www.domain.com/download/filename.zip">Download this file</A> should do it....

- Rob

glc
5-2-03, 03:06 PM
Oh, the
<A HREF="http://urlofmysite/download/filename.exe">the file name</A>
tag.

Great, thanks.

Rick_E
5-2-03, 10:52 PM
All web files, including the files to be downloaded, need to be be within the htdocs folder. So recreate the download folder inside htdocs and place your file to be downloaded there so it can be found.

glc
5-3-03, 12:39 PM
really?
Like I create a directory under htdocs as htdocs/download and put the files to be downloaded there so that the link
<A href="http://URL_of_mysite/download/filename.exe">name</A>
when clicked would work in downloading the file to the user?

Okay. Thanks.

Ah, how to I make the files in directories not under htdocs be accessible?

RadioRob
5-3-03, 02:10 PM
Hi there,

There is no way to make folders above htdocs and CGI-BIN accessable to the public. It's done that way for security.

Everything has to originate from those folders if you want the public to be able to download them.

The server can read from files not in htdocs, but it can't "serve" them if I remember correctly.

glc
5-3-03, 02:59 PM
Oh.
No problem.
Glad I found out the easy way.
I'll just create the directories under the htdocs then.

Thanks.

RadioRob
5-3-03, 03:01 PM
If you are not wanting people to be able to view the files and such in your download directory, you can put a .htaccess script in there, either password protecting it, or turning the DirectoryIndex off. (That will stop it from listing files.)

You can also upload a blank index.html file to that folder too.

Good luck!

Jackie Clark
5-27-03, 05:23 PM
I have read the following e-mails with regard to downloading a file and have tried to replicate on my web site and have been unsuccessful. Every time you click on Download file a windows error appears 404- File not found. I anyone could help it would be greatly appreciated. My code is as follows.

<a href= "http://www.wavebrake.biz/htdocs/download/waves.zip"> Download Movie (This May take several Minutes)</a>

Jackie

RadioRob
5-27-03, 05:58 PM
Hi there!

First of all, generally you don't want to include "htdocs" as part of your URL. You also don't want to create a NEW "htdocs" folder in your site.

What you do is connect to your site via FTP. Find the HTDOCS folder. In it should be ALL of your regular pages (such as index.html, etc)

Create a folder called "download". Put all of your files in there.

When you link to it... it should generally be like:

<a href= "http://www.wavebrake.biz/download/waves.zip"> Download Movie (This May take several Minutes)</a>

You don't include the htdocs reference in there. Treat "htdocs" like your main URL. htdocs = www.wavebrake.biz. :)

Good luck!

Jackie Clark
5-27-03, 06:11 PM
Thanks so much for your help.

Jackie

RadioRob
5-27-03, 06:22 PM
Glad to be of service. :) :)

We appreciate ya being a part of PowWeb.