Jump to content

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 "/".

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.