Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8872529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:14:31+00:00 2026-06-14T18:14:31+00:00

I am writing a php page to download a file from server to users.

  • 0

I am writing a php page to download a file from server to users. Here is my code:

  clearstatcache();
  //Output stream to client
  header("Pragma: public");
  header("Expires: 0");
  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  header("Cache-Control: private", false);
  header("Content-Type: application/zip");
  header("Content-Disposition: attachment; filename=\"" . $zipName . "\"; filename*=utf-8''" . rawurlencode($zipName) . ";");
  header("Content-Transfer-Encoding: binary");
  header("Accept-Ranges: bytes");
  header("Content-Length: " . (filesize($downloadFile)));


  $fp = fopen($downloadFile, "rb");
  ob_clean();
  while (!feof($fp) && ( connection_status() == 0 ) && !connection_aborted()) {
    print( fread($fp, 1024 * 1024));
    flush();
    ob_flush();
  }
  fclose($fp);

I am facing the problem: when user click the download button, the server send the file to users. While users downloading the file, users click download button again, the request does not execute now (all other request could not execute). When users download the first file completely, the second file is start.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:14:32+00:00Added an answer on June 14, 2026 at 6:14 pm

    Usually this happens when you are using a session. Check out this post. If you do not need session – simply turn it of for a download page. Or if you need it there – take all values you need at the beginning of a script and close session immediately. That will allow another script to be executed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing PHP code for a dynamic web page. The SQL query code
I am writing a PHP page to convert an uploaded file to XML. I
I'm re-writing a coldfusion page in PHP. I have an indexed cfloop and within
I am writing a web page that uses some php files. The php isn't
When writing PHP code for any given project, do you find you can write
Often when writing PHP I'll have it output some HTML like this - echo
I'm writing a php code where the user enter various details and then submits
I was writing a simple PHP page and a few foreach loops were used.
Hi I'm having some problem with a PHP page: I'm writing a little CMS
I'm writing a shell script to be executed by php page. The page has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.