Page 2 of 2
Posted: Mon Jul 31, 2006 12:34 pm
by volka
And the --> thing?
rustynail wrote:Is it possible that the version of MySQL that I am using has a bug
mysql delivers correct data, as was shown by
download:
row[filesize]: 674
strlen(bin_data): 900
strlen(datafix): 674
ord: 50 4b 03 04 14 00 00 00 08 00
50 -> P, not 20->space, so that's alright.
What about dbinfo.inc.php? Is there a space before <?php oder after ?> ..somewhere?
And another test for download.php
Code: Select all
$type = @mysql_result($result, 0, "filetype");
// header("Content-type: $type");
// header("Content-length: $size");
// header("Content-Disposition: attachment; filename=$name");
// header("Content-Description: PHP Generated Data");
flush();
headers_sent($h_file, $h_line);
echo $h_file, ':', $h_line;
// echo $datafix;
Posted: Mon Jul 31, 2006 12:49 pm
by rustynail
Everah | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
[quote="volka"]
What about dbinfo.inc.php? Is there a space before <?php oder after ?> ..somewhere?
[/quote]
Cut and paste of dbinfo.inc.php
Code: Select all
<?
$username="xxx";
$password="xxxxxxx";
$database="voc_doc";
$host="localhost";
?>
Will check the download script out shortly. Thanks!
Everah | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Posted: Mon Jul 31, 2006 12:59 pm
by volka
Hm, ich can highlight a character after ?>. Might be the board but it might also be present in the file and therefore be output.
Posted: Mon Jul 31, 2006 1:00 pm
by rustynail
volka wrote:
And another test for download.php
Code: Select all
$type = @mysql_result($result, 0, "filetype");
// header("Content-type: $type");
// header("Content-length: $size");
// header("Content-Disposition: attachment; filename=$name");
// header("Content-Description: PHP Generated Data");
flush();
headers_sent($h_file, $h_line);
echo $h_file, ':', $h_line;
// echo $datafix;
This returned
:0
Posted: Mon Jul 31, 2006 1:01 pm
by rustynail
volka wrote:Hm, ich can highlight a character after ?>. Might be the board but it might also be present in the file and therefore be output.
When brought up in an editor, there was a space after the ?>. Whoops, let me check.
Posted: Mon Jul 31, 2006 1:15 pm
by rustynail
rustynail wrote:
volka wrote:
What about dbinfo.inc.php? Is there a space before <?php oder after ?> ..somewhere?
Cut and paste of dbinfo.inc.php
Code: Select all
<?
$username="xxx";
$password="xxxxxxx";
$database="voc_doc";
$host="localhost";
?>
Will check the download script out shortly. Thanks!
Ok now there was a space after the ?> in dbinfo.inc.php and after it was removed things are working as they should

(I owe you one big time). Thank you Thank you Thank you!!!!
Please explain to me on why this made such a dramatic difference in how the file was downloaded? Was it because it would have been an html <space> that was transferred before the echo of the binary data?
By my default thinking, that should have been ignored. Something so little caused me so many headaches you wouldn't believe.
Posted: Mon Jul 31, 2006 1:27 pm
by volka
Anything outside a <?php ?> block is sent as-is to the client.That also applies to included files. If the script execution reaches the non-php block, all characters are sent to the client.
Obviously you have some kind of buffer active or otherwise the header() statements would have failed. And I just learned, that flush() is not enough to clear a buffer installed by output_buffering=4096 in php.ini :-S
It should have been
Code: Select all
ob_flush();
flush();
headers_sent($h_file, $h_line);
echo $h_file, ':', $h_line;