nahraj_soubor(); break; default: $this -> uvod(); break; }; } elseif (array_key_exists('soubor', $_GET) == true) { $this -> stahni_soubor(); } else { $this -> uvod(); }; } public function nahraj_soubor() { global $slozka, $adresa; if (is_dir('./'. $slozka)) { if (is_file('./'. $slozka .'/'.$_FILES['soubor']['name']) == false) { if (move_uploaded_file($_FILES['soubor']['tmp_name'], './'. $slozka .'/'. $_FILES['soubor']['name'])) { $_SESSION['info'] = 'Soubor byl uspesne nahran :-)'; $this -> presmeruj($adresa); }; } else { $_SESSION['info'] = 'Požadovaný soubor tu už MÁME!, máte smůlu :-P'; $this -> presmeruj($adresa); }; }; } public function vypis_seznam() { global $slozka, $adresa; $handle = opendir($slozka); while ($file = readdir($handle)) { if ($file != '.' && $file != '..' && $file != '.htaccess') { $this -> obsah[] = ''. $file .'
'; }; } closedir($handle); } public function stahni_soubor() { global $slozka, $adresa; if (is_file('./'.$slozka.'/'.$_GET['soubor']) == true) { $soubor = './'.$slozka.'/'.$_GET['soubor']; header('Content-Description: File Transfer'); header('Content-Type: application/force-download'); header('Content-Disposition: attachment; filename="'.$_GET['soubor'].'"'); readfile ($soubor); } else { $_SESSION['info'] = 'Požadovaný soubor tu nemáme, máte smůlu :-P'; $this -> presmeruj($adresa); }; } public function vypis_informace() { if(isset($_SESSION['info'])) { $this -> obsah .= $_SESSION['info']; unset($_SESSION['info']); }; } public function upload_formular() { global $slozka, $adresa; $this -> obsah .= 'Nahrání souboru na server
'; } public function uvod() { $this -> upload_formular(); $this -> vypis_informace(); $this -> vypis_seznam(); } public function presmeruj($kam) { header ('Location: '.$kam); exit; } }; ?>