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 111201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:20:50+00:00 2026-05-11T02:20:50+00:00

Digital commercial products that customers pay for download link. I have put all the

  • 0

Digital commercial products that customers pay for download link.

I have put all the zipped files (products) outside of web document root and buyers download them via a php script which is integrated with paypal IPN to make sure the downloader is a paying buyer.

Sort of like: http://www.mysite.com/download.php?buyer_id=xxx

Thus far it all works with only one problem. The zip files I download via the URL above is corrupted and can’t be opened correctly with WinRAR. However, directly downloaded zip is fine.

My code:

$path = WAREHOUSE_PATH.'/products/'.$identifier.'.zip'; $mm_type='application/octet-stream'; header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: public'); header('Content-Description: File Transfer'); header('Content-Type: ' . $mm_type); header('Content-Length: ' .(string)(filesize($path)) ); header('Content-Disposition: attachment; filename=''.basename($path).'''); header('Content-Transfer-Encoding: binary\n');  $fp = @fopen($path,'rb'); if ($fp) {   while(!feof($fp)) {     print(fread($fp, 1024*8));     flush();     if (connection_status()!=0) {       @fclose($fp);       die();     }   }   @fclose($fp); } 

What could be wrong? Thanks!

Problem solved: Thank you all for the tips. It turns out that the downloaded packages contains a few extra white spaces which shouldn’t be there. Silly.

  • 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. 2026-05-11T02:20:50+00:00Added an answer on May 11, 2026 at 2:20 am

    You’d be better off just using readfile(). Unless you have ignore_user_abort on, then the script will terminate automatically if the user cancels anyway.

    If you’re still having problems, load the file up in a hex editor and compare the first few characters and the last few characters.

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

Sidebar

Ask A Question

Stats

  • Questions 62k
  • Answers 62k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer It's called varargs (from the C syntax). See Sun's varargs… May 11, 2026 at 10:16 am
  • added an answer I have provided a bunch of links below, that answer… May 11, 2026 at 10:16 am
  • added an answer This is an MSDN article about creating an MSI Package… May 11, 2026 at 10:16 am

Related Questions

Digital commercial products that customers pay for download link. I have put all the
In a digital signal acquisition system, often data is pushed into an observer in
I'm looking for digital low pass filter code/library/class for a .net windows forms project,
I have a digital certificate that identifies a user. I need to use it
Is there an algorithm or some heuristic to decide whether digital audio data is
I've been assigned the task of buying a digital certificate for my company to
I'm re-designing an app I inherited that sends digital photos from a laptop to
Are there any libraries that can take a few digital pictures of an object
I have a bunch of short videos from my digital cam. i know how
I've been messing around with the free Digital Mars Compiler at work (naughty I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.