Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> readdir?
neo.priv
post
Post #1





Grupa: Zarejestrowani
Postów: 78
Pomógł: 0
Dołączył: 27.02.2004

Ostrzeżenie: (10%)
X----


Witam,
chce wyswietlic z okreslinego katalogu konkretny plik.
Robilem to przez opendir i readdir ale tu wyswietla mi cala zawartosc katalogu.

Sprobowalem poprzez fread i nic, wyswietlil mi zawartosc pliku.

Ja chcialbym zapytać w jaki sposob wysietlic nozwe i rozszerzenie konkretnego pliku?

1.
  1. <?php
  2.  
  3. $dir = '../pliki/';
  4. $start = opendir($dir);
  5. while ($file = readdir($start)){
  6. if($file!="." && $file!=".." && $file!="sys" && $file!="cgi-bin" && !is_dir($file)) {
  7.  
  8. echo "<a href="?file=$file&usun=usun">$file</a><br />";
  9. };
  10. };
  11.  
  12. ?>


2.
  1. <?php
  2.  
  3. [php]
  4. $dir = '../pliki/'$zdjeceiedytuj;
  5. $start = opendir($dir);
  6. while ($file = readdir($start)){
  7. if($file!="." && $file!=".." && $file!="sys" && $file!="cgi-bin" && !is_dir($file)) {
  8.  
  9. echo "<a href="?file=$file&usun=usun">$file</a><br />";
  10. };
  11. };
  12.  
  13. ?>

Kod
Warning: opendir(../pliki/1111.rtf): failed to open dir: To nie jest katalog in /home/httpd/vmhosts/test.php on line 265

Warning: readdir(): supplied argument is not a valid Directory resource in /home/httpd/vmhosts/test.php on line 266
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.09.2025 - 23:41