Question

HI. i am trying to open a local file from xml created by xlink i have parsed the file path in $resourceRef variable and it looks like that file:/./birds/birds.txt without the quotes. Please someone tell me why i cant open it. here is my code

$fh = fopen($resourceRef, 'r');
$theData = fread($fh, filesize($resourceRef));
fclose($fh);
echo $theData;

i get this error

Warning: fopen(file:/./birds/feathers.txt) [function.fopen]: failed to open stream: Invalid argument in C:\xampp\htdocs\test.php on line 31

Please someone guide me.

Was it helpful?

Solution

Your URI doesn't look correct, it should be either file://birds/birds.txt or just birds/birds.txt.

OTHER TIPS

Argument should be suitable path for a given platform (For widows "C:\\dir(...)" ), or correct URI ( file:// (...) )

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top