function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
r1985r1985 

Finding the attached file is pdf or not

Hi,

 

Kindly let me know how to identify whether the attachment in vf page is pdf file or not???

 

Thanks in advance,

MVP

kiranmutturukiranmutturu

just let me know r u getting that attachement from attachment object or not? if yes then in that u have a field called content type.. from that u will get the type of the attachement like if it is pdf u will get application/pdf...so on..

r1985r1985

No. I am uploading the file into the vf page and store it in a attachment. While uploading i must check it is pdf or not. If not, I should throw an error message to the user.

kiranmutturukiranmutturu

when u are uploading the file u will get the name along with extension like filename.pdf...may be u need to find in this way only...