Join the Stack Overflow Community
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I need one help.I need to upload the file and display the validation message using ng-file-upload in Angular.js.I am explaining my code below.

<div ng-class="{'myError': billdata.regdoc.$touched && billdata.regdoc.$invalid }">
    <input type="file" class="filestyle form-control" data-size="lg" name="regdoc" id="regdoc"  ng-model="regfile" ngf-pattern="'image/*'" accept="image/*" ngf-max-size="20MB" ngf-min-height="100" ngf-resize="{width: 100, height: 100}"  custom-on-change="uploadFile" required="required" ngf-select="onRegFileSelect($regfile);" >
</div>

Now,this filed is allowing the image only.But here i need this field should allow only pdf,ppt and .docx files.If any other file will upload the validation message should display.Please help me.

share|improve this question
    
look up ng-pattern in the github repo – feniixx Dec 28 '15 at 6:31
    
@feniixx : ok..i did this. – satya Dec 28 '15 at 6:36
    
ngf-pattern="'.pdf,.ppt,.docx'" ngf-accept="'.pdf,.ppt,.docx'" – danial Dec 28 '15 at 7:02
    
@danial : No,its like ngf-pattern="application/pdf,application/vnd.ms-powerpoint,a‌​pplication/vnd.openx‌​mlformats-officedocu‌​ment.wordprocessingm‌​l.document" accept="application/pdf,application/vnd.ms-powerpoint,applic‌​ation/vnd.openxmlfor‌​mats-officedocument.‌​wordprocessingml.doc‌​ument" this. – satya Dec 28 '15 at 7:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.