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

  • SEARCH
  • Home
  • 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 8143801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:12:38+00:00 2026-06-06T13:12:38+00:00

Here is the problem details: 1) I want to create dynamic (ip based) download

  • 0

Here is the problem details:

1) I want to create dynamic (ip based) download link. So user can’t download the file with different IP with the same download link.

2) Before start the actual download, i want to log this download request using php and perform some checks (verify the http referrer) to allow the user to download the actual file.

3) I also want the download file to be resumable and could be downloaded with download manager (with multiple download instances). Also want to limit the maximum number of allowed instances for each download.

4) The file size could be more than 200 MBs.

So, the solution which i am thinking is to create the download link with the md5 hash of user’s ip. E.g.
http://yourdomain.com/download.php?ip_hash=hash-of-the-ip&file=file-to-download

This is just a example but we can also create a nice link of this using htaccess.

What should i do next? I tried to do it using

header("Content-Type: $ctype");
header("Content-Length: " . filesize($file));
header("Content-Disposition: attachment; filename=\"$fileName\"");
readfile($file);

But using this the download does not remain resumable for the end user.

Is this fine to send large files using this method?

After doing some research, I came to know that the .exe files become corrupted for the end user using this way.

  • 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-06T13:12:40+00:00Added an answer on June 6, 2026 at 1:12 pm

    After doing some more research, i have found the answer of my question. I just thought i should share it with you guys as well.

    As rambo commented, we can use mod_xsendfile module of the apache server. We need to enable it if its disabled.

    Here is the link to download the module files if your apache does not have this module. Its available for mostly all the versions of apache and available for both x32 and x64.
    https://github.com/nmaier/mod_xsendfile

    You can use the following code to send the file using this apache module after doing all your custom validations.

    <?php
    //We want to force a download box with the filename hello.txt
    header('Content-Disposition: attachment;filename=hello.txt');
    
    //File is located at data/hello.txt
    header('X-Sendfile: data/hello.txt');
    ?>
    

    I hope it will help you guys 🙂

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

Sidebar

Related Questions

I have a problem here I can't solve. I have a database of houses
I have a problem here. Right now I'm doing my Web Based Application, my
Here are the details of my problem: I have a directory structure that looks
I want to create such layout: +-----------container-----------+ | +-----fixed-height-div-------+| | +-------fixed-height-div-----+| | +-fill-height-scrollable-div-+| | +-fixed-height-bottom-div-+| +---------end-container-------+ The problem
Maddening problem here. When my page loads: <body onload=getClientDateTime();> It runs this function: document.getElementById('ClientDateTime').value=hello
date here my problem: String datetime = 2012-03-24 23:20:51; I know that that string
Super weird problem here. I'm having trouble getting jQuery to bind any selectors except
What is the problem here? (Besides having redundant code). $.getJSON works as expected. However
I have a problem here. My Zend_Forms do not render in view script. Via
enter code here My problem is this: in this database the junction table contains

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.