php help please..

Forum
Last Post
Threads / Messages

maximillion

Member
Member
Joined
Jun 6, 2011
Messages
67
Points
0
Location
Rhode Island
Mysidian Dollar
5,082
k, i have this site and on it i have links to text files, but normally when you click the link - the link opens the file in the browser... what i want is instead of viewing it, i want to make the text files downloads...

the reason for this is i made a word search puzzle maker, but i am also offering free puzzles you can download. the puzzles are txt files - so viewing them is not what i want, but instead for them to download them and put them in the apps puzzle folder so they can play them with the app.
 
There isn't a sure way to make links that will download. Those are processed on the browser depending on the users settings.

Try using buttons:
<form><input type="button" value="Download Now" onClick="window.location.href='Your.txt'"></form>

I haven't tested it but it's worth a shot.
 
Maybe this PHP Code helps:
<?
header('Content-Disposition: attachment; filename="downloaded.pdf"');
?>

It'll force the browser to display the file download dialog.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,122
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Top