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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:21:11+00:00 2026-06-01T05:21:11+00:00

I have some images and pdf file on my server which I use in

  • 0

I have some images and pdf file on my server which I use in my website
The path to the images is

<img src ='/import/folder/image.jpg'>

Every image is associated with a pdf which resides with the image like the pdf for the above image will be at /import/folder/pdffile.pdf

the image source is visible to users

when some one view the source of page and copy the image source and paste in url after my base url

let suppose my base url is localhost.com
if some one manually write localhost.com/import/folder/image.jpg he can access my whole images and pdf file even my whole file system

How can I prevent users from accessing my file structure ?

I am using php and codeigniter

Thanks in advance

  • 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-01T05:21:12+00:00Added an answer on June 1, 2026 at 5:21 am

    In this case its difficult to prevent that people download your images. When you use “/import/folder/” its a public folder on your webspace. You can save the path with .htaccess.

    For Your PDF files you could deliver the PDF File over php.

    <a href="getpdf.php?file=123.pdf">Get PDF 123</a>
    

    In the script you can check if the user has the rights to download the file and wheather the file exists and return the PDF as application/pdf output.

    header('Expires: Thu, 19 Nov 1981 08:52:00 GMT'); 
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 
    header('Pragma: no-cache'); 
    header("Content-Type : application/pdf"); 
    header("Content-Disposition: attachment; filename=".$filename.".pdf"); 
    

    Then the people can download the file. But in this case you have to save PDF is theirs.

    Edit:

    Then put the .htaccess to the folder with

    deny from all
    
    <FilesMatch "\.pdf$">
        Order Allow,Deny
        Deny from all
    </FilesMatch>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website up and running which makes use of file uploads. Everything
I'm doing some low-level extracting of images directly out of a PDF file with
I have a PDF file containing some tabular data. http://dl.dropbox.com/u/44235928/sample_rotate-0.pdf I have to extract
Hi I have created a PDF file with an image in it, I want
Iam making a simple app, I display pdf file with some text and images
I have a pdf file and I want to view them as image file
I have some images that are wrapped within containers like this: <div id=swatchcontainer> <div
I have some images that need to change, based not only on hover, but
I have some images within icarousel. (about 20 images) I wanna 5 images in
I have some images, named SomeImage.png and SomeImage-hd.png( for retina). Everything looks with non-

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.