הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   php | failed to open dir (https://hosts.co.il/forums/showthread.php?t=58111)

FuZuL 19-12-07 23:26

php | failed to open dir
 
הקוד:
קוד:

<?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


DanielS 20-12-07 07:21

אוקיי.
בדוק אם לא התבלבלת בנתיב התיקייה.
2.הקובץ והתיקיה נמצאים בתיקיית הROOT ?

FuZuL 20-12-07 09:21

עריכה להודעה הראשונה:
$dir = "/folder/files/";
ולא התבלתי, והם לא נמצאים בROOT

בניה 20-12-07 10:01

הנתיב של התקיה לא נכון.
אתה יכול לדעת את הנתיב של התקיה עם
PHP קוד:

echo realpath('.'); 



כל הזמנים הם GMT +2. הזמן כעת הוא 08:29.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ