how can i get details about a file on my server e.g. size, type(php, txt, zip, jpg, gif) i've looked on google and php.net to no avail?

    May of the image types can be determined via the [man]getimagesize/man function (using the optional 2nd argument). For other types, you could parse the file name for any suffix and jump to a conclusion about its type, but that is obviously putting faith in the suffix being correct. Otherwise, you'll probably need to locate 3rd-party functions to actually read the file looking for the bits and bytes that typically indicate certain types of files.

      ok well i have tried using finfo_file() to get the extension but its parsing in the browser as an undefined function?

        can we see what you put into the php file?

          doesnt matter about the filetype found a snippet of code that works:

          To get file type:

             
          $path_info = pathinfo($filename); echo "File Type: " . $path_info['extension'];

          To get File Size:

          echo $filename . ': ' . filesize($filename) . ' bytes'; //displays file info
          
            Write a Reply...