Opendir Error; No such file or directory

This can be a very simple question. I work in the / mobile directory and I have photos in the / uploads directory.

I get an error message:

Warning: opendir(http://www.yoozpaper.com/uploads) [function.opendir]: failed to open dir: not implemented in /hermes/bosweb/web088/b881/ipg.yoozpapercom/mobile/sportspage.php on line 313

I put this in the variable $ dir = "http://www.yoozpaper.com/uploads"

for the image src=$dir/$file .

Please note that this works when I work with files in the main directory.

Any help on this would be greatly appreciated.

Code below:

 $dir = "http://www.yoozpaper.com/uploads"; 

// open the directory

 if ($opendir = opendir($dir)) { 

// read the directory

 while (($file = readdir($opendir)) !==FALSE) { if ($file==$imagename) 

// can indicate height and width below

 echo "<img width='75%' height='30%' src='$dir/$file' title='$headline - Yoozpaper News Online' alt='$headline'><br /><br />"; 
+4
source share
2 answers

You need to understand the difference between the file system and the HTTP daemon.
Although they have a somewhat similar appearance, these are completely different issues.

To use opendir, you need to open the * directory, not the HTTP resource.

 opendir('../uploads'); 

must work

 opendir($_SERVER['DOCUMENT_ROOT'].'/uploads'); 

would be better as it will always point to the uploads directory, no matter where you named it.

+8
source

http://www.yoozpaper.com/uploads us the url is not a directory. You cannot access it using opendir. You need a system path to it, for example, "/ home / user / public_html / uploads" or something like that. Get directory path using file manager or control panel

It could be "/ hermes / bosweb / web088 / b881 /" in your case. but not sure. Anyway, get the local path

+1
source

Source: https://habr.com/ru/post/1394954/


All Articles