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
vivek gvivek g 

How to get type of a file in <apex:inputfile>

Hi All,

how to get "type" of a file in <apex:inputfile>.

type is nothing but Extension of file.

For Eg:1) Type=xls for excel
            2) Type=txt for text files.

Thanks,
 Vivek g.

NagaNaga (Salesforce Developers) 
I understand that you want to know the uploaded file type in <apex:inputfile>

Please let me know if the following script works for you

<input type="file" value="{!attachment.body}" name="{!attachment.name}" id="file" accept="image/jpeg, image/png"> </input>

Best Regards
Naga kiran
Vijay NagarathinamVijay Nagarathinam
Hi Vivek,

Refer the following link, you get some idea about your requirement.

https://developer.salesforce.com/forums/ForumsMain?id=906F000000097bLIAQ
Moussa BENBOUZIDMoussa BENBOUZID
Thanks Naga, it works for me