הקוד:
קוד:
<?php
$fileName = "songs";
$dir = "/test6/files/";
$openddir = opendir($dir) or die("cannot open dir");
while(FALSE != ($read = readdir($openddir)))
{
if(strstr("songs", $read) != FALSE)
$rightfile = $read;
}
?>
<OBJECT ID= "MediaPlayer1" WIDTH=320 HEIGHT= 240
CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..."
TYPE="application/x-oleobject">
</OBJECT>
<SCRIPT>
function StartMeUp ()
{
Player.URL = "<?php echo "$dir"."$rightfile"; ?>"
}
function ShutMeDown ()
{
Player.controls.stop();
}
</SCRIPT>
אם אני לא טועה, זה בודק אם יש קובץ בשם fileName בתיקייה, לא משנה מה הסיומת..
והוא מכניס אותו לתוך נגן [כמובן שהנגן מריץ רק mp3,avi.wma אבל זה לא חשוב]
שגיאה:
קוד:
Warning: opendir(/folder/files/) [function.opendir]: failed to open dir: No such file or directory in /home/...../folder/check5.php on line 3
cannot open dir