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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:46:02+00:00 2026-06-01T21:46:02+00:00

Maybe I am being daft, or misunderstanding either WAMP restrictions or browser restrictions, but

  • 0

Maybe I am being daft, or misunderstanding either WAMP restrictions or browser restrictions, but I have created a PHP file explorer view using the scandir function recursively using Ajax, and it works great to display the files from our network share (\computername\share).

I can launch the files when accessing http://localhost, however if from the same localhost machine I access http://[our_external_ip_address] then the files do not open. The path in the status bar displays the same on both (e.g. file://computername/share/filename.zip). I eventually want to put the files on a network share which is on the same domain as our web host machine.

Please help. I am fairly competent with PHP & JS but when it comes to web hosts and the like, I am stuffed. TIA.

James

  • 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-01T21:46:05+00:00Added an answer on June 1, 2026 at 9:46 pm

    Massive thanks to DaveRandom – this solution worked to allow PDF / Word / Zip files from a UNC path to be launched from an external web client.

    FILE 1: – index.php

    <?php
        $filename= *** insert UNC path to file *** // e.g. \\share\computername\New Document.doc
        $extension= pathinfo($filename, PATHINFO_EXTENSION); // Gets extension for file
        $displayFilename= *** insert shorten filename *** // e.g. New Document.doc
    ?>
    
    
    <a href="filehandler.php?name=<?php echo $filename; ?>&ext=<?php echo $extension; ?>&shortname=<?php echo $displayFilename; ?>"><?php echo $displayFilename; ?></a>
    

    FILE 2: – filehandler.php

    <?php
    $filename = $_GET['name'];
    $extension = $_GET['ext'];
    $shortfilename = $_GET['shortname'];
    if ($extension == "pdf")
    {
        header("Content-type: application/pdf"); // act as a pdf file to browser
    }
    if ($extension == "doc")
    {
        header("Content-type: application/msword"); // act as a doc file to browser
    }
    if ($extension == "zip")
    {
        header("Content-type: application/zip"); // act as a zip file to browser
    }
    header("Content-Disposition: inline; filename='$shortfilename'"); 
    
    $file = readfile($filename);
    echo $file;
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

maybe I'm being daft or something but I've added a @try @catch block to
Maybe I am being stupid, but this isn't making sense to me... I have
I just thought about this maybe being useful, but I can't find a way
Maybe I'm being picky, but in javadoc there is a following information about LinkedHashSet
So, PHP apparently feels like being a moron today. Or maybe it's me. Or
Maybe I'm being stupid but I can't figure out why a pointer is being
Maybe I'm being misled by my profiler (Netbeans), but I'm seeing some odd behavior,
Say I have created an XIB for an icon view. I then want to
Maybe it's just too early in the morning and I'm being an idiot, but
I think I am being a bonehead, maybe not importing the right package, but

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.