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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:39:55+00:00 2026-06-18T06:39:55+00:00

do you know if it’s possible to make a file only available for download

  • 0

do you know if it’s possible to make a file only available for download by clicking a link in code, and restrict access by trying to access the file from copy/pasting the URL in your address bar?

Example:

I generate invoices as PDF, and I want to make them available only for logged in customers and only the invoices that are generated for this specific customer. Customer A is not allowed to see the invoices from Customer B and vice versa.

Now I save these invoices here:
http://www.mydomain.com/invoices/

and an invoice for Customer A is something like:
http://www.mydomain.com/invoice/20130202_120045.pdf

now I want to make it possible that a customer can only see this PDF when I add a link like this in HTML:

<a href="http://www.mydomain.com/invoice/20130202_120045.pdf">See invoice</a>

but the PDF should NOT be accessible by typing in directly http://www.mydomain.com/invoice/20130202_120045.pdf in the address bar.

is this in some way possible ?

  • 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-18T06:39:56+00:00Added an answer on June 18, 2026 at 6:39 am

    There are multiple approaches, but I’d say this is the easiest one:

    • Store the actual PDF in a directory only accessible by PHP (outside your web root or blocked by .htaccess for example).
    • Verify access in the PHP script.
    • Let the download happen through a PHP script using the header Content-disposition to set the filename and using readfile() to output the file contents.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Know if it's possible to access the iPhone compass in Safari using JavaScript? I
I know that Phonegap has an event for back button, but it's only available
I know that it is not possible to access the ringtones in iOS, but
Know this might be rather basic, but I been trying to figure out how
Anyone know how I can make a login button in Ruby on Rails for
I know there are lots of tools on the net that can make our
I know how you can disable all NSLog messages from answers like this one
I know it is common that we use the code below to embed a
I am trying to render a haml file in a javascript response like so:
Know of a way to mock %[]? I'm writing tests for code that makes

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.