473,480 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

forcing a txt file download

lmb
Hi all,

Does anyone know how to force the download of a text file ?
In my script, I tried : header("location: my_text_file.txt") ;
....and of course, I get my text in my browser as I wanted a download dialog
box to appear.

Any help,

Many thanks in advance,

--
lmb
Jul 17 '05 #1
2 1908
lmb
"lmb" <lm*@nospam.org> a écrit dans le message news:
40***********************@news.free.fr...
Hi all,

Does anyone know how to force the download of a text file ?
In my script, I tried : header("location: my_text_file.txt") ;
...and of course, I get my text in my browser as I wanted a download dialog box to appear.

Any help,

Many thanks in advance,

--
lmb


Oops, ok, I've just found.
was :
header("Content-type: application/force-download");
header("Content-Disposition: attachment; filename=test.txt");
readfile("test.txt");

--
lmb
Jul 17 '05 #2
lmb wrote:
Does anyone know how to force the download of a text file ?


Intimidation, thuggery, trickery... Sorry, that's all for the moment.

--
Jock
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1756
by: D. Alvarado | last post by:
Hello, I have a page that generates a text file (but writes the file with the ".csv" extension) and then I redirect the user so he can save the file header("Location: $my_csv_file"); ...
1
3244
by: thegump | last post by:
I have a href link and its a MP3 file and I want to download it to the clients machine but when I click on it, it wants to play it and not download it. How do I stop this. I was told to change the...
3
8604
by: Julie | last post by:
I have an html file where I display name,address,zip. It is one per line so it is basicall a list of addresses. But I would like ie6 to force the download prompt of this long list of names...
1
1192
by: Do | last post by:
Hi, My issue is twofold. 1) How do I invoke a "save file" action when a user clicks a button. In classic ASP, I used to response.redirect to file path. But I want to keep the user on the...
4
3384
by: randmCP | last post by:
Hi and thanks in advanced for you help. I am working on a file-distribution asp.net application. Users click on a custom grid column to download files stored on a SQL DB. The client does not want...
1
1681
by: Brett Kelly | last post by:
Ok, I know this sounds odd. Let me explain further. I have an ASP.net page (w/ C# code behind) that, when given a session variable containing the path to a local file, will attempt to start the...
4
1510
by: teeBull | last post by:
Hi all, We'd like to take advantage of code we already have for transforming XML into HTML (using XSLT) for our users to save the HTML as an MS Word document locally. I've dug around and found...
14
4481
by: Irfan12 | last post by:
i dont know php & i want a script that when a user click on a mp3 hyperlink, the mp3 file start downloading instead of start playing in media player. i got a sxript from internet search. i am using...
1
1258
by: pedjasmek | last post by:
I'm using this script to force browser's download dialog : $fp=fopen('Survivor - Eye of tiger.mp3','r'); $name=basename("Survivor - Eye of tiger.mp3"); $size=filesize('Survivor - Eye of...
0
7051
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6915
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7054
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6750
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4794
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3003
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2993
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
567
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.