Pari
Pari

Reputation: 21

script not terminating immediately

I have a script that lets the user download files (stored in a blob field after doing a bin2hex() )

function hex2bin($h){ ... }
// code to get $filecontent,$filesize,$uploadname from database
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header("Content-Length: $filesize");
header('Content-Disposition: attachment; filename="'.$uploadname.'"');
echo hex2bin($filecontent);

everything is working fine, except the browser is taking 3 to 4 seconds after downloading the file to finally terminate the http session.

Any clue whats causing that.

thanks. Pari

Upvotes: 1

Views: 103

Answers (2)

Pari
Pari

Reputation: 21

Turns out there was an ob_start("ob_gzhandler") in one of the include files. Removing it solved the issue.

thanks everyone. Pari

Upvotes: 1

GabiMe
GabiMe

Reputation: 18503

Probably the "code to get $filecontent,$filesize,$uploadname from database" is the problem. Show it

Upvotes: 0

Related Questions