Download file instead of showing it

J

Jens Müller

Hello,

is there a http-header to tell Firefox/IE to force to download a file (show
"save as" dialog) instead of showing the contents (e.g. a .txt file)?

How can this be done with Apache?

Thanks!
 
A

Adrienne Boswell

Hello,

is there a http-header to tell Firefox/IE to force to download a file
(show "save as" dialog) instead of showing the contents (e.g. a .txt
file)?

How can this be done with Apache?

Thanks!

You would have to change the content type. Probably the best thing to do
all around is put the txt file into a zip file and offer that.
 
J

Jonathan N. Little

Jens said:
Hello,

is there a http-header to tell Firefox/IE to force to download a file
(show "save as" dialog) instead of showing the contents (e.g. a .txt file)?

How can this be done with Apache?

PHP

$filename='somefile.txt';
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename="' . $filename . '"');
echo $fileContents;
 
N

Newzie

Hello,

is there a http-header to tell Firefox/IE to force to download a file (show
"save as" dialog) instead of showing the contents (e.g. a .txt file)?

How can this be done with Apache?

Thanks!

Remove the mime type ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top