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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:52:57+00:00 2026-05-12T14:52:57+00:00

How to access and display the images that are located outside the application folder?

  • 0

How to access and display the images that are located outside the application folder? Let’s say I have a file directory that stores all the images and other file types, and this file directory is located on a different drive then my application folder. For certain file types ( such as .pdf, .doc, I want to prompt the user to download those files).

As far as I know, it’s not possible to put absolute path in the <img src attributes, i.e, img src="D:\\file directory"> doesn’t work. And also I want to restrict the access to login user only.

I am using PHP as my server side language.

Note: <img src="file:/// .../> won’t work in Firefox. See here for comments.

Edit: Since only authenticated user can access those images, and since I have an index.php that checks for all the incoming requests, filters off non-authenticated users, I don’t think creating an Apache Alias will work.

Here’s an example of my conf file:

  NameVirtualHost *:80
  <VirtualHost *:80 >
    ServerName pmmenu.businessjob.net
    DocumentRoot "D:\web"
    DirectoryIndex index.html index.php
    <Directory  "D:\web">
       AddDefaultCharset UTF-8
       Order Deny,Allow
       Allow from all
       RewriteEngine on
       RewriteBase /
       RewriteRule ^$ index.html [QSA]
       RewriteRule ^([^.]+)$ $1.html [QSA]
       RewriteCond %{REQUEST_FILENAME} !-f

       # no, so we redirect to our front web controller
       RewriteRule ^(.*)$ index.php [QSA,L]
    </Directory>
  </VirtualHost>
  • 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-12T14:52:57+00:00Added an answer on May 12, 2026 at 2:52 pm

    I think you’re missing a basic concept here. All HTML is interpreted client-side. Every image is downloaded seperately by the browser of your visitor. As your visitors can only access those files that are public, “file:///something” will not work for them, because this asks their browser to access the local (their) filesystem, which will either be blocked or not find the requested image as it is not stored on their disk.

    So you will have to publish those pictures and make them accessible via http to allow your visitors to see them. You could do this by creating a subdomain or a virtual directory.

    Since you want only authenticated users to be able to see them, you could also create a php file that checks whether the user is authenticated, e.g. like this:

    if(user_is_authenticated()){
        $pathToFile = "d:\images\myimage.jpg";
        $handle = @fopen($pathToFile, "rb");
        $contents = @fread($handle, filesize($pathToFile));
        @fclose($handle);
        //sent appropriate header
        header('Content-type: image/jpeg');
        echo $contents;
    }
    

    But you have to be aware that this script will always read the whole image and print it subsequently, which is a huge overhead.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use text_area_value.splitlines() instead. Then you don't have to worry about… May 13, 2026 at 6:50 am
  • Editorial Team
    Editorial Team added an answer Within Hudson you can chain multiple jobs together. You could… May 13, 2026 at 6:50 am
  • Editorial Team
    Editorial Team added an answer These lines are the problem: string s1 = "INSERT INTO… May 13, 2026 at 6:50 am

Related Questions

It's a long one so you might want to get that cup of tea/coffee
I've got an MS-Access app (1/10th MS-Acccess, 9/10ths MS-SQL) that needs to display photographs
My goal is to create an eBook that I can read with the Mobipocket
I have a C# app with a combo box. I was add items to

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.