This may be a very easy question. I am working in directory /mobile and I have photos in a directory /uploads.
I am getting the error:
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 am putting this into a variable $dir = "http://www.yoozpaper.com/uploads"
for the image src=$dir/$file
.
Note that this is working when I am working with files in the main directory.
Any help on this would be greatly appreciated.
Code below:
$dir = "http://www.yoozpaper.com/uploads";
//open directory
if ($opendir = opendir($dir))
{
//read directory
while (($file = readdir($opendir)) !==FALSE)
{
if ($file==$imagename)
//can specify height and width below
echo "<img width='75%' height='30%' src='$dir/$file' title='$headline - Yoozpaper News Online' alt='$headline'><br /><br />";
You have to understand the difference between a filesystem and an HTTP daemon.
Although they have somewhat similar appearance, it is absolutely different matters.
To use opendir, you have to open *a directory, not HTTP resource.
opendir('../uploads');
should work
opendir($_SERVER['DOCUMENT_ROOT'].'/uploads');
would be better as it will always point to the uploads directory, no matter from where you called it.
http://www.yoozpaper.com/uploads us a URL not a directory. You can't access it using opendir. You need the system path to it for example "/home/user/public_html/uploads" or something. Get the path to the directory using your file manager or control panel
It might "/hermes/bosweb/web088/b881/" in your case. m not sure though. In any case, get the local path
来源:https://stackoverflow.com/questions/9155992/opendir-error-no-such-file-or-directory-found