[phplib] Extension of Files From: Jose Luis Rodríguez Sevilla (joseluis <email protected>)
Date: 07/07/00

I want to know if a file ($f) is an image file; i try to extract the extension (.gif or .jpg) of this file but i don't know how i can do it.

If you know how, tell me a part of code of this or an example.

 if (isset($FILE)){
  $f = $FILE;
  if (filesize($f) < $max_file_size){

   $complet_file = explode(".", $FILE);
   $pos = count($complet_file);
   $pos = $pos - 1;
   $extension = $complet_file[$pos];
   
   $ext = strtolower($extension);

   if (($ext == "gif") || ($ext == "jpg")){
..........

}

Thank You.