Is there somewhere already in FileField to display an image depending on the file type? Or is there another module that will do this?

Comments

mohammed j. razem’s picture


Mohammed J. Razem
http://www.vardot.com
Vardot

stephtek’s picture

I dont want the user to have to upload an image every time they have a file upload. I mostly just want a pdf to have a pdf icon, excel file to have an excel icon etc....

vsr’s picture

Could you do something like this in your CSS?

a[href $='.pdf'] { 
   padding-right: 18px;
   background: transparent url(icon_pdf.gif) no-repeat center right;
}
stephtek’s picture

I have never seen CSS like that before. Does that work?

stephtek’s picture

WOW. that is amazing. Works perfectly!!