CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Force href to download and not display

 



tbone587
User

Mar 13, 2012, 7:20 PM

Post #1 of 4 (780 views)
Force href to download and not display Can't Post

I have created a cgi script that gathers info and generates a .conf file at the end. I then have a standard link on the site to download the file. When you click the link it displays the config file within the browser as opposed to downloading it. How do I redirect it so it downloads instead?


Code
a href=\"/filepath/$Host_Name.conf1\">Download configuration</a></td>



wickedxter
User

Mar 13, 2012, 8:10 PM

Post #2 of 4 (777 views)
Re: [tbone587] Force href to download and not display [In reply to] Can't Post

chmod the file if the server is linux or unix ....


tbone587
User

Mar 14, 2012, 7:03 AM

Post #3 of 4 (757 views)
Re: [wickedxter] Force href to download and not display [In reply to] Can't Post

This is not a permissions issue. The problem is when you click the link it displays the config in the browser as a page. I need it to load a download prompt when you click the link.


wickedxter
User

Mar 14, 2012, 4:11 PM

Post #4 of 4 (740 views)
Re: [tbone587] Force href to download and not display [In reply to] Can't Post

this im sure has to do with the server config then b/c its assuming the *.config file is the same as a *.txt file and is just returning it to the broswer..

if your using apache server and have access to the httpd.conf file look for this" DefaultType text/plain " (w/o quotes) it will allow you to define that file type so it will download like a *.zip file would.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives