I am downloading files from my server using a very simple script:
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($fichero));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Cont开发者_StackOverflow社区rol: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
It works fine, but while the browser is downloading the file I cannot browse through the site or downloads other files from the same server. I have to wait until it finishes. It happens in Chrome & Firefox and I have also used other methods to download files with PHP, but with all of them I have this problem...so I suppose it's a problem in the server??
Thank you very much in advance :)
This is because you are using PHP sessions, and while a session for one user is opened in one request, the same session cannot be opened in an other request.
Do a session_write_close() before readfile().
精彩评论