Page 1 of 1

How to include a file from internal network?

Posted: Sat Nov 19, 2005 8:14 am
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?

Posted: Sat Nov 19, 2005 8:54 am
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.