[英]ng-file-upload with several patterns
I'm using ng-file-upload and I'm trying upload images or pdf files. 我正在使用ng-file-upload,并且正在尝试上传图片或pdf文件。 I created simple form with file input, but it accept only pdf files. 我用文件输入创建了简单的表单,但仅接受pdf文件。 If I change order to 'image/*, .pdf'
it accept only images but not pdf. 如果我将订单更改为'image/*, .pdf'
则仅接受图片,而不接受pdf。 How can I accept images and pdf files? 如何接受图片和pdf文件?
<input type="file" ngf-select ng-model="picFile" name="file" ngf-pattern="'.pdf, image/*'" accept="'.pdf, image/*'" ngf-accept="'.pdf, image/*'" ngf-max-size="2MB" required ngf-model-invalid="errorFile">
Example here http://jsfiddle.net/maqbzv15/3835/ 此处的示例http://jsfiddle.net/maqbzv15/3835/
逗号后的空格应删除ngf-pattern="'.pdf, image/*'"
Try below code for upload image and pdf file. 尝试使用以下代码上传图片和pdf文件。
ng-accept="'.pdf,.jpg'|validate($file)"
and for multiple file you have to set ng-multiple to true 对于多个文件,您必须将ng-multiple设置为true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.