Forcing Firefox to show "Save as" dialog, or automaticly start downloading the file? |
Author: |
Message: |
Mike
Elite Member
Meet the Spam Family!
Posts: 2795 Reputation: 48
32 / /
Joined: Mar 2003
|
O.P. Forcing Firefox to show "Save as" dialog, or automaticly start downloading the file?
Hello.
I have a text file (with a changed extension) on my webserver.
When I click the link of the file in firefox, firefox just displays the contents of the text file while IE automaticly opens the file, which is what I actually want to happen...
Or, if I cant do that, show the save as dialog instead of displaying what the file has...
I searched google and i found this: http://www.codecomments.com/PERL_CGI_Beginners/message611929-1.html
Well, as I'm not using Perl, but PHP, I didn't really understand what he did...
Can anyone help me?
I think it has something to do with the headers....
Thanks!
|
|
11-21-2005 07:09 PM |
|
|
MeEtc
Patchou's look-alike
In the Shadow Gallery once again
Posts: 2192 Reputation: 60
39 / /
Joined: Nov 2004
Status: Away
|
RE: Forcing Firefox to show "Save as" dialog, or automaticly start downloading the file?
make a link to the file, Right-click, Save link as...
I cannot hear you. There is a banana in my ear.
|
|
11-21-2005 07:15 PM |
|
|
Mike
Elite Member
Meet the Spam Family!
Posts: 2795 Reputation: 48
32 / /
Joined: Mar 2003
|
O.P. RE: Forcing Firefox to show "Save as" dialog, or automaticly start downloading the file?
quote: Originally posted by MeEtc
make a link to the file, Right-click, Save link as...
But, I want it to show a save us dialog, and dont have to make the user to do it manually....
|
|
11-21-2005 07:18 PM |
|
|
Stigmata
Veteran Member
Posts: 3520 Reputation: 45
21 / /
Joined: Jul 2003
|
RE: Forcing Firefox to show "Save as" dialog, or automaticly start downloading the file?
|
|
11-21-2005 07:34 PM |
|
|
stoshrocket
Senior Member
formerly methos
Posts: 748 Reputation: 31
34 / /
Joined: Aug 2005
|
RE: Forcing Firefox to show "Save as" dialog, or automaticly start downloading the file?
easiest way i can think of is just saving it into a .zip file then getting them to download it that way, if it is a .txt file it wont take long to download. As for the actual thing that guy did i cant figure it out, but ill keep looking for you, if i find anything ill post it back to you.
|
|
11-21-2005 07:35 PM |
|
|
Dempsey
Scripting Contest Winner
http://AdamDempsey.net
Posts: 2395 Reputation: 53
38 / /
Joined: Jul 2003
|
RE: Forcing Firefox to show "Save as" dialog, or automaticly start downloading the file?
you can set the header to force the server to send the file, something like:
code: header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$filename"\");
|
|
11-21-2005 07:38 PM |
|
|
Mike
Elite Member
Meet the Spam Family!
Posts: 2795 Reputation: 48
32 / /
Joined: Mar 2003
|
O.P. RE: Forcing Firefox to show "Save as" dialog, or automaticly start downloading the file?
quote: Originally posted by Stigmata
http://www.mozilla.org/support/firefox/options#downloads
file types?
would that work?
Well, i want to show the save as for all my visitors, not just only me... quote: Originally posted by Methos2
easiest way i can think of is just saving it into a .zip file then getting them to download it that way, if it is a .txt file it wont take long to download. As for the actual thing that guy did i cant figure it out, but ill keep looking for you, if i find anything ill post it back to you.
Well, its a .pls (winamp playlist) file, fore my internet radio, so I think that it would be boring to have to open the zip to connect to my internet radio...
Thanks for your help anyway
|
|
11-21-2005 07:41 PM |
|
|
rav0
Veteran Member
i have an avatar
Posts: 1419 Reputation: 29
35 / /
Joined: Aug 2003
|
RE: RE: Forcing Firefox to show "Save as" dialog, or automaticly start downloading the file?
Save the file with as something.php, and add this code at the very top: code: <?php
header('Content-Type: application/pls+xml');
?>
| |
(\ /)
(O.o)
(> <)
This is Bunny. Copy Bunny into your signature to help him on his way to world domination
|
|
11-22-2005 07:47 AM |
|
|
Mike
Elite Member
Meet the Spam Family!
Posts: 2795 Reputation: 48
32 / /
Joined: Mar 2003
|
O.P. RE: Forcing Firefox to show "Save as" dialog, or automaticly start downloading the file?
I dont know...
When I put the header, it will ask me if I want to download the php file...
|
|
11-22-2005 01:26 PM |
|
|
rav0
Veteran Member
i have an avatar
Posts: 1419 Reputation: 29
35 / /
Joined: Aug 2003
|
RE: RE: Forcing Firefox to show "Save as" dialog, or automaticly start downloading the file?
quote: Originally posted by Mike
When I put the header, it will ask me if I want to download the php file...
Whose headers, mine or Dempsey's? Dempsey's should ask you if you want to download the file, but not the PHP file, the proper playlist. Mine shouldn't do that at all, assuming settings in the user agent.
| |
(\ /)
(O.o)
(> <)
This is Bunny. Copy Bunny into your signature to help him on his way to world domination
|
|
11-23-2005 09:53 AM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|