1

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

3
  • Can you check the content-length is coming out correctly Commented Oct 23, 2009 at 8:45
  • Have you tried sending the Connection: close header ? Commented Oct 23, 2009 at 8:51
  • Thanks Greg & svens turns out i was doing a ob_start("ob_gzhandler") in one of the include files, which is causing the delay. I turned it off and the download script is working fine now. thanks for the help folks. Commented Oct 23, 2009 at 9:09

2 Answers 2

1

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

thanks everyone. Pari

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.