Jump to content

Error with open stream/file


Awanka

Recommended Posts

The following line:

 

$fcontents = file("/resources/weekly_highlights/HighlightsList.txt");

 

throws the following error:

 

Warning: file(/resources/weekly_highlights/HighlightsList.txt) [function.file]: failed to open stream: No such file or directory in C:\APPS_DEV\RM\Highlights.php on line 25

 

however the following works:

 

"src="/resources/weekly_highlights/HighlightsList.txt"

 

I can't figure out why this error is occurring.

 

/resources/ is a virtual directory pointing to another server if that matters.

Link to comment
https://forums.phpfreaks.com/topic/70546-error-with-open-streamfile/
Share on other sites

if the folder "resources" is not at the root of your web server, you won't be able to to refer to it as the root,

if its above the root then you need to adjust your call to that file.

 

you could also use the ip to that and link from there, ie:

<?php
$FileDirIp = 'http://100.100.01.01';
$fcontents = file($FileDirIp . "/resources/weekly_highlights/HighlightsList.txt"); 

 

Good luck

I can't use a direct http:// link.  I run into access issues.  Access is only allowed through the resources virtual directory.

 

My question basically is what kind of pathnames can src= accept that file functions like file() cannot.  what's the difference between the sort of pathnames the two use.  I think it's probably something wierd like the pathname has to end with a "/".

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.