I'm pulling random files from a folder named 'video' and including them. I don't have the ability to hard code in the file names, so I'm using this:
I keep getting the following error (but it's not consistant - just sporadic)PHP Code:<?php $path11 = 'video/';
$handle = opendir ($path11);
while (($filename = readdir ($handle)) !== false)
{
if ($filename != '.' && $filename != '..')
{
$file_array[] = $filename;
}
}
$rand = rand (0, count ($file_array));
include ($path11 . $file_array[$rand]); ?>
Line 12 is this line:Code:Warning: main(video/) [function.main]: failed to open stream: No such file or directory in /home/xxxxxx/public_html/auto/xxxxx/randomvid.php on line 12 Warning: main(video/) [function.main]: failed to open stream: No such file or directory in /home/xxxxx/public_html/auto/xxxxx/randomvid.php on line 12 Warning: main() [function.include]: Failed opening 'video/' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxxx/public_html/auto/xxxx/randomvid.php on line 12
include ($path11 . $file_array[$rand]);
Right now there are only a handful of files in the video folder and they all have the same contents. Just can't figure out why I get the inconsistent failures.... any ideas? A way to fix it? Etc...




Bookmarks