I am having problems with downloads with the GetRight download manager. No
problem with any of the browsers, but GetRight is using the page name
instead of the 'content-disposition: attachment; filename=' value.
Heres the code I am using :-
~~~ download.php ~~
<?php
$filename = './/files//bookmark.html';
$mimetype = 'text/html';
//if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5') or
// strpos($_SERVER['HTTP_USER_AGENT'], 'Opera 7')) {
// $mimetype = 'application/x-download';
//}
header('content-disposition: attachment; filename="' .
urlencode(basename($filename)) . '"');
header('content-type=' . $mimetype);
header('content-length=' . filesize($filename));
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Accept-Ranges: bytes");
readfile($filename);
?>
~~~~~
GetRight (www.getright.com) is displaying the filename 'download.php', then
the file 'save as' dialog is displaying 'RENAME.ME' temporarily before
displaying the correct file name 'bookmark.html', so it all works okay if
you wait a while, then GetRight says it has downloaded a web page, so there
is a hickup in the works, but it all works right if you just hit cancle.
Many thanks in advance,
Aaron
I would think the people to ask would be the ones who developed GetRight.
And remember - anything you send in to the client is a recommendation,
not an order. The client is free to ignore it.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================
Yes I realizes this, I have probably got a few days before they start up
again after new years celebrations. So will try to solve it independantly
before then.
Happy New Year,
Aaron
Yes.
> And remember - anything you send in to the client is a recommendation, not
> an order. The client is free to ignore it.
I found I was using equals signs instread of colons :-
>> header('content-type=' . $mimetype);
>> header('content-length=' . filesize($filename));
So it is behaving differently now, the glitsch is gone but GetRight is still
not working now it is not getting the correct filename at all its just
getting the script files filename now :(
So it worked better with the glitch, if you knew to wait a while on the Save
As dialog for the filename to change from RENAME.ME to the correct one.
:)
Aaron
Aaron
>I am having problems with downloads with the GetRight download manager. No
>problem with any of the browsers, but GetRight is using the page name
>instead of the 'content-disposition: attachment; filename=' value.
Some browsers like old IEs for example have the same problem. Either
they completely ignore the Content-Disposition header or interpret it in
a wrong way. One usual solution was/is to use URL rewriting to make the
filename part of the path. If the URL looks something like
http://example.com/download.php?file=foo.bar
then with rewriting you could change it to
http://example.com/download/foo.bar
which should then work as expected.
Micha
Nice one Micha, looks like the best solution all round.
I will still persue the original problem and see if that can be fixed easily
enough or not.
Rewriting may well be what everyone uses though ?
Thanks,
Aaron
No, most people now use browsers which work properly.
It must be a server side thing as GetRight works with all the download sites
I have used it with so far appart from "my" or SitePoint's code. They must
be using 'content-disposition: attachment' otherwise XML and other stuff
would appear in IE.
I wanted to know what SourceForge uses as they had lots of problems with IE,
but could not seem to telnet to it for some reason :(
Any bright spark fill me in on this ?
Aaron
It must be a server side thing as GetRight works with all the download sites
I have used it with so far appart from "my" or SitePoint's code. They must
be using 'content-disposition: attachment' otherwise XML and other stuff
would appear in IE rather than as a download.
I wanted to know what SourceForge uses as they had lots of problems with IE,
but could not seem to telnet to it for some reason :(
Any bright spark fill me in on this ?
Aaron
>It must be a server side thing as GetRight works with all the download sites
>I have used it with so far appart from "my" or SitePoint's code. They must
>be using 'content-disposition: attachment' otherwise XML and other stuff
>would appear in IE rather than as a download.
>
>I wanted to know what SourceForge uses as they had lots of problems with IE,
>but could not seem to telnet to it for some reason :(
Why Telnet? If you want to sniff headers, you can for example
use the LiveHTTPHeaders extension in Firefox, Opera's Dragonfly
or <http://web-sniffer.net>. No need to do it all by hand.
Micha
Nice, thank you again,
Aaron
I've never used it, so I have no idea. But they very well could just be
taking the filename from the URI. It's all a guess, though.
> I've never used it, so I have no idea. But they very well could just be
> taking the filename from the URI. It's all a guess, though.
Yes, the URL GetRight dispalys is the URL, but it or Windows gets the
filename correct after first displaying "RENAME.ME" for 10 seconds, thats if
you use and equals sign in the 'content-disposition: attachment; download=',
but if you use a colon it takes the URL and gets it wrong.
So its a buggy edge to GetRight I think, but it does work with all other
download code appart from mine !
Aaron
Well, as Micha said - get the Live HTTP Headers extension for Firefox.
It's a must for any web developer, IMHO.