0

i want to print/echo a file that's save on my server and have a specific URL and try this below code to read

$lines = file($files['file_path']);
foreach ($lines as $line_num => $line) {
   echo htmlspecialchars($line) . "<br />\n";
}

but it returned the following error :

file(http://myweburl/uploads/files/1506514901_txt.txt): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found

and i also try fgets with fopen function that return same error

i also follow How to read a file line by line in php but don't get any solutions

while above function is working on localhost but not server

please help

Manoj Rana
  • 3,068
  • 1
  • 24
  • 34

1 Answers1

0

Try to enable :

allow_url_fopen = on 

in php.ini file on your server