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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:57:56+00:00 2026-05-27T04:57:56+00:00

so suppose my server is located in http://www.example.com I then put a file file.exe

  • 0

so suppose my server is located in http://www.example.com

I then put a file file.exe in the files directory in the root server hence normally you can download that file by typing this into the browser

http://www.example.com/files/file.exe

And suppose that I have a php script that first authenticates the user and then redirect them to that file.exe download page

eg. using this method:

   header('Location: http://www.example.com/files/file.exe');
   exit(0);

what is the best way to

1.) prevent unauthenticated users from being able to access that file by typing in that URL above And

2.) have the php script still able to serve that file despite 1.) hence authenticated users should be able to download that file on that location

supposing that I use the standard LAMP stack (also I use Zend Framework)

  • 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-05-27T04:57:56+00:00Added an answer on May 27, 2026 at 4:57 am

    0: Match your file with keys in database. EG. file.exe = 2fae

    1: Let user go to

    http://www.example.com/download.php?key=2fae

    2/3: Check if user has the right to download that key/file.

    3/2: Lookup in database, match that key with actual file path

    4: On download.php, write.

    header('Content-disposition: attachment; filename='.$actual_file_path_and_name);
    header('Content-type: application/exe'); // optional
    readfile($filename);
    

    It lets user download file.exe without letting him see the actual URL of file.exe. It happens on download.php.

    Ref: http://webdesign.about.com/od/php/ht/force_download.htm

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

Sidebar

Related Questions

suppose i have a file missing at http://www.mydomain.com/user/10202.html i.e user.php then the server gives
Suppose that I want my ASP.net web server to open a file and then
Suppose I want to put objects that identify a server into a stl set
Let's suppose I have xml like this one: <Server Active=No> <Url>http://some.url</Url> </Server> C# class
Suppose I have some PHP code running inside a web server, for example, running
suppose if i want to develop a windows chat application then a chat server
Suppose there is no proxy between the http client and the http server there
Suppose my javascript called server(AJAX call) and then got server response with an array
Suppose I am executing several queries on the server using mysql_query . The results
Suppose that there're two types of packet in the chatting server. Those two packets

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.