Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> usuwanie pliku poprzez przycisk
Randallmaster
post
Post #1





Grupa: Zarejestrowani
Postów: 677
Pomógł: 11
Dołączył: 18.11.2009

Ostrzeżenie: (0%)
-----


Napisałem takie coś:

  1. <?
  2. $directory="cennik/";
  3. $dir=opendir($directory);
  4.  
  5. $files_tab = array();
  6. while($file_name=readdir($dir))
  7. {
  8.  
  9. if(($file_name!=".")&&($file_name!=".."))
  10. {
  11. $file_path = $directory.$file_name;
  12. $file_tab = array ($file_name, filesize($file_path));
  13. array_push($files_tab, $file_tab);
  14. }
  15. }
  16.  
  17. closedir($dir);
  18.  
  19. $suma = 0;
  20.  
  21.  
  22. for ($i=0; $i<count($files_tab); $i++) {
  23.  
  24. $nazwa = $files_tab[$i][0];
  25. $rozmiar = $files_tab[$i][1];
  26. if(isset($_POST['usun'])){
  27. unlink($nazwa);
  28. }
  29. echo '
  30.  
  31. <table cellspacing="0" summary="">
  32. <tbody>
  33. <tr>
  34. <td>nazwa:</td>
  35. <td>'.$nazwa.'</td>
  36. <td>rozmiar</td><td>'.$rozmiar.'</td>
  37. <td><a href="link/'.$nazwa.'">pobierz</a></td><td>
  38. <form method="POST" action="main.php">
  39. <input type="submit" name="usun" value="USUŃ">
  40. </form></td>
  41. </tr>
  42. </tbody>
  43. </table>';
  44. $suma += $rozmiar;
  45. }
  46. echo 'informacja';
  47. ?>


Wszystko działa tylko dlaczego nie działa przycisk usuń(IMG:style_emoticons/default/questionmark.gif)

Ten post edytował Randallmaster 26.10.2011, 20:50:46
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: 27.09.2025 - 06:44