Invalid file types are correctly not added to the model but turn the form invalid
See original GitHub issueSo I have this snippet which actually works fine adding multiple files on multiple drags/selects, until I add an invalid file type. The invalid file type is not added to the model but will make the form invalid. The form becomes valid again when I add/append another valid file to the list. I tried put allowInvalid false, ngf-valid-only but none of them solve my problem. Always get the form.files.$error = {“pattern”:true} when adding an invalid file. How can I make these unsupported file types not turn the form invalid?
<div name="files" ngf-drop ngf-select ng-model="ui.files" class="drop-box"
ng-model-options="{allowInvalid: false}"
ngf-drag-over-class="{accept:'dragover', reject: 'reject-dragover'}"
ngf-multiple="true" ngf-allow-dir="true"
accept="{{ui.validFileTypes}}" ngf-keep="true" ngf-valid-only="true"
ngf-change="filesChanged()"
ngf-pattern="ui.validFileTypes" required>
</div>
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:19 (9 by maintainers)
Top Results From Across the Web
Vue vuelidate not working file type input - Stack Overflow
But it's not working in form upload file validation. Because file type input can't set v-model attribute and I have the below error...
Read more >Invalid File Type - CoSchedule Support
If the file is a different type, you will receive the Invalid File Type error: "When uploading a file, it must be the...
Read more >How to Fix the “Sorry, This File Type Is Not Permitted for ...
This is an easy first step: If the file name extension is incorrect, then you can fix it and upload the file in...
Read more >Excel cannot be open the file 'filename.xlsx' because the file ...
Hi All, I have a excel.xlsx file saved in my system which has been corrupted . ... because the file format or file...
Read more >How to Change the Allowed File Types in the File Upload ...
But you can add or remove file types whenever you want. ... form-file-upload-invalid-extension-error-min.png. How did it go?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I was still having trouble with ngf-ignore-invalid. invalid files weren’t being added but the form was still being set as invalid. I checked the source and found a logic typo.
#1685 should fix it
now, if there were a way to ignore invalid files (not validate them) but still give a message? I’ve tried other fixes in the forums but my form has other fields in it that I want to check.
@danialfarid How can I show my images thumbnail. for example I have this https://es.stackoverflow.com/questions/90609/error-al-mostrar-preview-de-imagen-en-angularjs `
` I want to show thumbnail of 2 images but always show in ng-model number 1 How can I fix that?