Far be it from me to question the wisdom of tweaking the headers, but why do
you need them at all?
Why can't you just do:
a href =filename.txtclick here/a
which, so far as I can see, will load said text page into the user's browser
window as soon as they click on the link. If the user
that requires some form of trust in the user... I experience too many stupid
people in what I do on a day to day basis and it is just easier if it forces
a download...
typical user experience: I were a user and there was a link to a word
document that i wanted to edit. If I clicked on the link
Yeah, but the title of this thread says to download a TEXT FILE, not a Word
document.
No-one with any sense would ever download a Microsoft Word document off the
internet by choice, unless they had a serious amount of trust in the web
site owner, were browsing over a secure connection using SSL,
you could also try this:
header(Content-Type: application/octet-stream);
header(Content-Type: application/force-download);
header(Content-Disposition: attachment; filename=$name);
header(Content-Transfer-Encoding: text);
or this
header( Content-type: application/octet-stream );
header(
Matt,
You should NEVER force a download on anyone. How do they know it isn't
carrying a virus.
What you should do is to send the headers that prompt a dialog box for Save
or Open (I'm sure you've seen this).
I'm not sure which headers you use for csv or txt files but I do this with
PDFs all the