How to include a file from internal network?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aqh2
Forum Newbie
Posts: 2
Joined: Sat Nov 19, 2005 7:50 am

How to include a file from internal network?

Post by aqh2 »

I have a few files that reside on an internal network at my university. I need to make it accessible to http users without loading it in my web folder (for storage space reasons).

So for example, file is sol.pdf.

It resides in \\networkdrive\folder\subfolder\.

The Webserver for web files is web.university.edu.
The raw file path to it is \afs\cad\u\m\m\mms\public_html\[web files].

I wanted to include sol.pdf in a page by fetching it from the \\networkdrive\folder\subfolder\ using the include() function.

If i post a link directly to the network drive, it is only accessible at my university. Not over the web.

How do I manipulate include to make that work?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

I'm guessing that the web server is running linux so you'll need to use a different path for the NFS.

I've never tried this so I can't guarantee it works...

Code: Select all

$path_to_file = 'servername:/path/to/file/on/server.pdf';

$data = file_get_contents($path_to_file);
That's assuming your university network is using NFS.... if this is *just* samba file sharing I'm not sure how you'd include it directly in a PHP script.
Post Reply