1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

How to know the file Type in Iphone Directory

Discussion in 'iPhone/iPad Programming' started by RashiMahajan, Nov 16, 2009.

  1. macrumors newbie

    In my programm
    I am viewing all the files present at a location, Now i want to know the type of the file,that wether its a .png file,.jpg file,.doc or it is a folder? so that i will display a appropriate thumbnail next to it.
    Is there any way to know that whether its a file/folder or which type of file in objective C.
  2. macrumors regular

    Look at the NSFileManager documentation, particularly the fileAttributesAtPath method.
  3. macrumors newbie

    No file extension info

    But its display "NSFileTypeDirectory" or either "NSFileTypeRegular" as file type . It display NSFileTypeRegular for all jpg/png/doc/pdf file No way to knw the extension of the files ?
  4. macrumors newbie

    You can read the files at the documents folder store it in some array
    and then using string separator you can separate the file name and the extension.
  5. macrumors newbie

    Thanks sneha, i was also thinking the same way bt is there any API available whcih can abstract this info also
  6. macrumors newbie

    They have not provided any API in the NSFileManager documentation at least. :rolleyes:

Share This Page