Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.

LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 03-18-2010, 08:02 AM
Junior Member
Join Date: 01-23-10
Location: Nigeria
Posts: 6
iTrader: 0 / 0%

Someone help me Please.
I have a TEXT FILE on my website that I want visitors to download. When I link it, instead of downloading, it will open in a browser.

How can I go about it.
Reply With Quote
  #2 (permalink)  
Old 03-18-2010, 11:08 AM
Hades's Avatar
Senior Web Developer
Latest Blog:

Join Date: 01-23-07
Location: Argentina
Posts: 2,273
iTrader: 0 / 0%
You can output headers with PHP, something like:
PHP Code:
 header('Content-Type: application/force-download');
header('Content-Disposition: attachment; filename="'.$name.'"');
header("Content-Transfer-Encoding: binary");
header('Accept-Ranges: bytes'); 
where $name is the path to the file to be downloaded.
Cristian Espinoza ~ Sr. Web Developer
Currently available for Freelance Web Development

(+54 9) 1155 601 661
Skype: espinoza.cristian
Reply With Quote
  #3 (permalink)  
Old 03-19-2010, 03:23 AM
Junior Member
Join Date: 01-23-10
Location: Nigeria
Posts: 6
iTrader: 0 / 0%

Thank you. Let me try it.
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i have someone download a file after pay pal? adambomb007 Coding Forum 2 11-29-2007 06:26 AM
What script? Download / File managment jags2ooo Coding Forum 5 06-12-2007 11:19 PM
Having same text on every page by only editing one file? games_master Coding Forum 6 01-03-2006 01:00 AM
How can I insert a menu in text form into an external .css file Jason Web Design Lobby 1 11-19-2004 07:38 AM
Robot text file. Alan30 Marketing Forum 3 09-17-2004 03:13 PM

V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory

All times are GMT -7. The time now is 05:29 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2014 Escalate Media

Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.