Want to show files in my app?

I creating the app in which the user upload any type of file at the remote server, and then i want to each file when they want.

when user want to see the attachment i just got JSON array with that particular attachment file as URL.

how i can separate file type and show category of the file like PDF, EXCEL, WORD, TXT, PNG, JPG, etc.
how could i show each file when the user click on that icon?