I am facing an issue while selecting file using Angular.js. Here is my code:
<div ng-class="{'myError': billdata.compregdoc.$touched && billdata.compregdoc.$invalid }">
<input type="file"
class="filestyle form-control"
data-size="lg"
name="compregdoc"
id="compregdoc"
ng-model="compregfile"
ngf-pattern="application/pdf,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
accept="application/pdf,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
ngf-select="onCompRegFileSelect($file);"
ngf-max-size="2MB">
<div style="clear:both;"></div>
</div>
</div>
<div class="help-block"
ng-messages="billdata.compregdoc.$error"
ng-if="billdata.compregdoc.$touched">
<p ng-message="pattern" style="color:#F00;">This field only accepts .pdf,.ppt,.docx files.</p>
<p ng-message="maxSize" style="color:#F00;">File is too large.Max size is 2 mb.</p>
</div>
In this case I am only able to upload pdf
type file. But here I need pdf,ppt,docx,excel
format file upload. When I am selecting the docx file it is showing me the validation message that This field only accepts .pdf,.ppt,.docx files
.
ngf-pattern=".ris"
. Am I doing something wrong?ngf-pattern="'.ris'"
andaccept=".ris"
. Both were needed.