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
UrviUrvi 

Problem in <apex:inputfile accept ="doc, txt" />

Hi,

I am facing problem in

<apex:inputfile accept="doc, txt, pdf, zip" value="{!attachment.body}" filename="{!attachment.name}" contentType="{!fileContentType}" fileSize="{!uploadFileSize}"></apex:inputfile>

accept="doc, txt, pdf, zip" property this i have applied still it will accept all files in open file dialogue...

 

It will accept all files and we have to write validations manually.

 

Is there any other way or am i going wrong with this?

 

Please let me know ASAP

 

Thanks in Advance

Urvi

bob_buzzardbob_buzzard
According to W3C : "The accept attribute is not properly supported by any of the major browsers."
GaneshSFGaneshSF

I recently used this and it works as expected in Chrome21.0, Firefox 15.0 and IE 9

 

"

<apex:inputFile id="addFile" accept="doc,docx,pdf,xls,xlsx"

"

Digvijay Singh ChouhanDigvijay Singh Chouhan
It worked for me when I used  <apex:inputFile accept="image/jpeg,image/pjpeg,image/jpeg,image/png,image/gif,image/bmp"/>
to allow only image to be uploaded .