简体   繁体   English

如何在Angular.js中使用ng-file-upload限制上传多个文件

[英]How to limit to upload mulpltiple files using ng-file-upload in Angular.js

I need one help.I need keep limit of selecting files using ng-file-upload in Angular.js.I am explaining my code below. 我需要一个帮助。我需要限制使用Angular.js中的ng-file-upload选择文件的权限。我在下面解释我的代码。

<input
  type="file"
  class="filestyle form-control"
  data-size="lg"
  name="bannerimage"
  id="bannerimage"
  ng-model="file"
  ngf-pattern="'image/*'"
  accept="image/*"
  ngf-max-size="2MB"
  ngf-min-height="100"
  ngf-resize="{width: 100, height: 100}"
  custom-on-change="uploadFile"
  required="required"
  ngf-select="onFileSelect($file);"
  ngf-multiple="true"
>

Here i have multiple file selecting scenario but i need user can only select maximum 5 files after that it can not select any file.Please help me. 在这里,我有多个文件选择方案,但我需要用户最多只能选择5个文件,之后它就不能选择任何文件。请帮助我。

What about the attribute ngf-select-disabled 那么ngf-select-disabled属性呢

With a condition like "myFiles.length > 5" ? 使用“ myFiles.length> 5”这样的条件?

You could add ngf-drop-disabled too if te user can use drag and drop. 如果用户可以使用拖放功能,也可以添加ngf-drop-disabled。

https://github.com/danialfarid/ng-file-upload https://github.com/danialfarid/ng-file-upload

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM