alin19 Posted March 10, 2008 Share Posted March 10, 2008 how can i create a link for a download? i usualy used exactly the adres of the file, but i have a txt file and the instead of downloading it shows the file in the webpage Quote Link to comment Share on other sites More sharing options...
alin19 Posted March 10, 2008 Author Share Posted March 10, 2008 let me explain more detailed: i have a txt file on the server that contains a text : test test test test and i want the clients do download this text file, if the insert the adress of the text file: localhost/test.txt the browser writes : test test test test (exactly what is in the text file) Quote Link to comment Share on other sites More sharing options...
bradkenyon Posted March 10, 2008 Share Posted March 10, 2008 $filename = 'test.txt'; header("Content-Length: " . filesize($filename)); header('Content-Type: application/text'); readfile($filename); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.