errors with download/display pdf
errors with download/display pdf
hi out there, dear community.
i think, i was a little bit too hasty with my reply on seedy's problem with firefox 2.0 and his download problems. (http://www.phpwcms.de/forum/viewtopic.php?t=13199)
i made some tests and hope that anyone can comprehend these results... and hopefully have a helping suggestion.
i tested my pages with firefox (in version 1.5.x and 2.x) and internet explorer (version 6) and got the following astonishing results:
setting inline_download = 1:
displaying pdf was stopped (message "angehalten") with firefox
displaying pdf in internet explorer worked well
setting inline_download = 0:
downloading pdf in firefox worked well (open with application and saving on hardisk)
downloading pdf in internet explorer only worked with downloading on harddisk, but not "open with application" (error message "file not found")
so now i have the problem that i cannot decide what option to take....
the websites are hostet on apache 1.3.3 (unix) and php 4.4.4. (but i cannot change this.)
can anyone help me please?
thanks in advance,
dennis
i think, i was a little bit too hasty with my reply on seedy's problem with firefox 2.0 and his download problems. (http://www.phpwcms.de/forum/viewtopic.php?t=13199)
i made some tests and hope that anyone can comprehend these results... and hopefully have a helping suggestion.
i tested my pages with firefox (in version 1.5.x and 2.x) and internet explorer (version 6) and got the following astonishing results:
setting inline_download = 1:
displaying pdf was stopped (message "angehalten") with firefox
displaying pdf in internet explorer worked well
setting inline_download = 0:
downloading pdf in firefox worked well (open with application and saving on hardisk)
downloading pdf in internet explorer only worked with downloading on harddisk, but not "open with application" (error message "file not found")
so now i have the problem that i cannot decide what option to take....
the websites are hostet on apache 1.3.3 (unix) and php 4.4.4. (but i cannot change this.)
can anyone help me please?
thanks in advance,
dennis
- Oliver Georgi
- Site Admin
- Posts: 9907
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
- Oliver Georgi
- Site Admin
- Posts: 9907
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
download.php
Any interim solution before the patch is out? The current version is unstable both on IE and FF...
Should we use 'download.php' from previous distro?
Seb
Should we use 'download.php' from previous distro?
Seb
- Oliver Georgi
- Site Admin
- Posts: 9907
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
- Oliver Georgi
- Site Admin
- Posts: 9907
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
- Oliver Georgi
- Site Admin
- Posts: 9907
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
Hello Oliver,
As my tests were not conclusive with v126, I turned back to the 'download.php' v129pre that Oliver provided earlier and I noticed that it had a new way of processing the query string... As I did not install the complete overnight distro (pre129), I uploaded only 'download.php' and edited it as follow:
I commented these two lines:
and replaced it with the following:
I seems to be working just fine (w inline download disabled). Again, I'll run some more tests and I'll keep you guys posted.
Thanks for your assistance.
Seb
As my tests were not conclusive with v126, I turned back to the 'download.php' v129pre that Oliver provided earlier and I noticed that it had a new way of processing the query string... As I did not install the complete overnight distro (pre129), I uploaded only 'download.php' and edited it as follow:
I commented these two lines:
Code: Select all
$countonly = empty($_GET['countonly']) ? false : true;
$hash = empty($_GET['f']) ? '' : clean_slweg($_GET['f']);
Code: Select all
if(!empty($_SERVER['QUERY_STRING'])) {
list($hash) = explode('&', $_SERVER['QUERY_STRING']);
$hash = trim(str_replace('=', '', $hash));
if(!empty($_GET['target'])) {
$phpwcms["inline_download"] = 1;
} elseif(isset($_GET['target']) && $_GET['target'] == '0') {
$phpwcms["inline_download"] = 0;
}
}
Thanks for your assistance.
Seb
After much investigation, I found what was compromising the 'download.php'. In the 'dl_file_resume' function ('inc_lib/functions.file.inc.php'), where all the headers are written you will find the following code:
It appears that the http range thing is causing problems especially with pdfs (moreover, $_server['HTTP_RANGE'] is not configured on my server). So I changed the first line to :
and everything went back to normal ( distro 1.2.8 ).
Any thoughts on this config?
Seb
Code: Select all
header("Accept-Ranges: bytes");
$size=filesize($file);
//check if http_range is sent by browser (or download manager)
if(isset($_SERVER['HTTP_RANGE'])) {
list($a, $range)=explode("=",$_SERVER['HTTP_RANGE']);
//if yes, download missing part
str_replace($range, "-", $range);
$size2=$size-1;
$new_length=$size2-$range;
header("HTTP/1.1 206 Partial Content");
header("Content-Length: ".$new_length);
header("Content-Range: bytes $range$size2/$size");
} else {
$size2=$size-1;
header("Content-Range: bytes 0-$size2/$size");
header("Content-Length: ".$size);
}
Code: Select all
header("Accept-Ranges: none");
Any thoughts on this config?
Seb