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 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

Related Questions

I have a web page that displays .gif images, I want to display only
I am working on an iPhone Application that stores images in the Applications 'Document'
I am making an application which requires me to list all the images available
I can't display images in JSP (and can't access other things like external Javascript/jQuery
Hi i try to do that example http://openlayers.org/dev/examples/all-overlays.html in my django application. I use
In my application,I have to load volumedata from set of images (MRC images) and
I just created a javscript plugin that waits for all the images. The following
I've got an MS-Access app (1/10th MS-Acccess, 9/10ths MS-SQL) that needs to display photographs
I have a TileList with thumbnail images. Under each thumbnail images I display the
I have a wpf application that is using a NavigationWindow that allows me to

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.