Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell driver drivers email error ethernet excel firefox firefox 3 freeze game hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook 2007 outlook express partition password problem router slow software sound trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
downloading .txt files


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
AvvY's Avatar
Computer Specs
Senior Member with 1,912 posts.
 
Join Date: Oct 2004
Location: Melbourne, Australia
Experience: "Ah, what the hell is that?"
11-Mar-2005, 06:07 PM #1
downloading .txt files
On my site I am offering some guides which at .htm/l based with screen shots and all that other fancy mumbo jumbo, but I also have written versions of the guides as .txt format - these versions I want people to be able to save to their HDD for future use.

I have set it up so that you click an image and it links to the .txt files, but all it does is display the .txt file like you would a web page- same formatting of course.

how is it that I make it so when you click the image a little "save as" box pops up and lets you save it to your HDD like it would with an .exe file from sourceforge.net - for example?

Late,
__________________
BurgerWithTheLot.com Productions "Where creativity and talent meet."
BillC's Avatar
Distinguished Member with 2,349 posts.
 
Join Date: May 2003
Location: Atlanta, Georgia
11-Mar-2005, 06:52 PM #2
This might give you some ideas that are useful. http://www.ossweb.com/article-16.html
AvvY's Avatar
Computer Specs
Senior Member with 1,912 posts.
 
Join Date: Oct 2004
Location: Melbourne, Australia
Experience: "Ah, what the hell is that?"
11-Mar-2005, 06:58 PM #3
So basically I will need to zip the .txt files? - I thought that would probably be an easy solution. Thanx,

Late,
Elvandil's Avatar
Moderator with 29,386 posts.
 
Join Date: Aug 2003
Location: Vermont
11-Mar-2005, 07:00 PM #4
The easiest thing to do without reconfiguring anything would be to simply post an advisory to use the right-click "Save Target As..." for those who wanted to download the file rather than just view it.
AvvY's Avatar
Computer Specs
Senior Member with 1,912 posts.
 
Join Date: Oct 2004
Location: Melbourne, Australia
Experience: "Ah, what the hell is that?"
11-Mar-2005, 07:02 PM #5
- Not a bad idea actually too! I will see which will work best in my setup. Thanx for the suggestions!

PS. Elvandil - congrats on becoming a mod, you deserve it, you have helped me a fair bit since I have been a member .

Late,
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
11-Mar-2005, 09:08 PM #6
If your webhost supports PHP, you can use a simple script to tell the browser to download instead of open it.
AvvY's Avatar
Computer Specs
Senior Member with 1,912 posts.
 
Join Date: Oct 2004
Location: Melbourne, Australia
Experience: "Ah, what the hell is that?"
11-Mar-2005, 10:27 PM #7
Really? my webhost does support PHP - what kind of scirpt do I need? Do you know anywhere I can get one from?

Late,
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
11-Mar-2005, 11:01 PM #8
Mostly from php.net:
PHP Code:

<?php
ini_set
('open_basedir','.');
$file 'download-this.txt';
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Length: ' filesize($filename));
header('Content-Disposition: attachment; filename=' basename($file));
readfile($file);
?>
For security reasons, its set to only open files in the same directory in the script, but that can be changed.
Elvandil's Avatar
Moderator with 29,386 posts.
 
Join Date: Aug 2003
Location: Vermont
11-Mar-2005, 11:07 PM #9
Quote:
Originally Posted by bigavvystyle
- Not a bad idea actually too! I will see which will work best in my setup. Thanx for the suggestions!

PS. Elvandil - congrats on becoming a mod, you deserve it, you have helped me a fair bit since I have been a member .

Late,
Thanks. Came as something of a surprize to me. You'd be amazed at how much goes on in the background .

I'm not sure what the equivalent to "Save Target As..." is in Mozilla/Firefox, but you may want to post that, too, if you go that route.

Most browsers are configured to load text files rather than download them and you don't need everybody changing their browsers around. And though the zip idea will work, it still surprizes me how many people mention in here that they don't have an unzipper or don't know what to do with it.

The simpler, the better.
__________________
Microsoft MVP
Windows Shell/User
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
11-Mar-2005, 11:12 PM #10
The Firefox menu reads "Save Link As" instead of "Save Target As"
AvvY's Avatar
Computer Specs
Senior Member with 1,912 posts.
 
Join Date: Oct 2004
Location: Melbourne, Australia
Experience: "Ah, what the hell is that?"
12-Mar-2005, 12:34 AM #11
Quote:
The simpler, the better.
Yeah, very true.

brendan - Thanx so much for the script, but now I am going to be very stupid but ask, what do I do with it? I don't know anything of PHP really. Do I copy that into notepad and save it as a php file? If so what extension? Then how do I incorporate that into the website? I use DreamweaverMX04 mainly - and do hand coding for some parts.

Late,
__________________
BurgerWithTheLot.com Productions "Where creativity and talent meet."
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
12-Mar-2005, 04:39 PM #12
Notice in the script where I wrote 'download-this-file.txt'
Change the filename to the file you want to download. Save it as a .php file, and upload it to the folder with the txt file in it. Make sure you leave all the quotation marks, etc exactly as I wrote them.
__________________
-Brendan
AvvY's Avatar
Computer Specs
Senior Member with 1,912 posts.
 
Join Date: Oct 2004
Location: Melbourne, Australia
Experience: "Ah, what the hell is that?"
12-Mar-2005, 07:38 PM #13
Ok I did that, but how do I get that .php file to interact with the .htm page that the link is on?

Late,
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:37 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.