Witam,
Mam stworzone funkcje sprawdzenia pliku typu, ktora ma taki kod:

  1. function sprawdz_typ()
  2. {
  3. switch ($_FILES[$this -> obrazek]['type']) {
  4. case 'image/jpeg':
  5. $this -> komunikat = true;
  6. break;
  7. case 'image/png':
  8. $this -> komunikat = true;
  9. break;
  10. case 'image/gif':
  11. $this -> komunikat = true;
  12. break;
  13. default:
  14. $this -> komunikat = 'Niewłaściwy format, proszę wskazać plik w formacie: '.$this -> typy;
  15. //$this -> komunikat = false;
  16. //$dane = false;
  17. break;
  18. }
  19. return $this -> komunikat;//array($this -> komunikat;$this -> TrueFalse);
  20. }


gdy sprawdzam ja tak:
  1. if (is_string($this ->sprawdz_typ()) == false)
to dziala, gdy wskazuje plik graficzny to funkcja przepuszcza dalej, a w przeciwnym wypadku dostaje komunikat, nastepnie stworzylem funkcje do wysylania fotek:

  1. function zapisz_plik()
  2. {
  3. if(is_uploaded_file($_FILES[$this -> obrazek]['tmp_name']))
  4. {
  5. $temp = explode(".", $_FILES[$this -> obrazek]["name"]);
  6. $this -> rozszerzenie = end($temp);
  7. list($width, $height) = getimagesize($_FILES[$this -> obrazek]['tmp_name']);
  8. if ($width == $this ->szerokosc && $height == $this ->wysokosc)
  9. {
  10. if(!move_uploaded_file($_FILES[$this -> obrazek]['tmp_name'], $this -> sciezka.$this->nazwa_pliku.'.'.$this -> rozszerzenie))
  11. {
  12. $this -> komunikat = 'problem: Nie udało się skopiować pliku do katalogu.';
  13. return $this -> komunikat;
  14. } //else return $this -> komunikat = true;
  15. }
  16. else {
  17. $this -> komunikat = 'Plik jest niewłaściwych rozmiarów, proszę wskazać plik o rozmiarze: '.$this ->szerokosc.'x'.$this->wysokosc.'px';
  18. return $this -> komunikat;
  19. }
  20. }
  21. else
  22. {
  23. $this -> komunikat = 'problem: Możliwy atak podczas przesyłania pliku.';
  24. //$dane 'Plik nie został zapisany.';
  25. return $this -> komunikat;
  26. }
  27. $this -> komunikat = true;
  28. return $this -> komunikat;
  29. }


No i sam zapis chodzi okey, ale mam problem z funkcja IS_UPLOADED_FILE, gdy odpalam ja bezposrednio $this -> zapisz_plik(), dostaje true, ale gdy uruchomie ja w ten sposob:
  1. if (is_string($this ->sprawdz_typ()) == false){
  2. $this -> zapisz_test(); }

To dostaje zwrocony to: $this -> komunikat = 'problem: Możliwy atak podczas przesyłania pliku.';

Nie wiem czemu sie tak dzieje, moze ktos z Was bedzie w stanie mi pomoc.

mozna wykasowac, znalazlem blad w wyswietlaniu wink.gif