最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Only allow specific file extensions in angular-file-upload module to be clickable - Stack Overflow

programmeradmin1浏览0评论

I'm using this module,

I am using their simple example, /

When you click "Choose file" button, it will open a window which allows us to pick a file that we want to upload. What I would like to happen is to only allow specific file extensions to be clicked. Is there a non-documented configuration which will do that?

For example, in the config, we only allowed .txt extensions, when I click "Choose file" button, it will open up a window and show all the files. However, files that doesn't have the extension .txt will be disabled.

I'm not doing this for security purposes. I am just following the design/instructions provided to me. :) I can always use mitm tools to intercept and allow other extensions to be uploaded.

I'm using this module, https://github.com/nervgh/angular-file-upload

I am using their simple example, http://nervgh.github.io/pages/angular-file-upload/examples/simple/

When you click "Choose file" button, it will open a window which allows us to pick a file that we want to upload. What I would like to happen is to only allow specific file extensions to be clicked. Is there a non-documented configuration which will do that?

For example, in the config, we only allowed .txt extensions, when I click "Choose file" button, it will open up a window and show all the files. However, files that doesn't have the extension .txt will be disabled.

I'm not doing this for security purposes. I am just following the design/instructions provided to me. :) I can always use mitm tools to intercept and allow other extensions to be uploaded.

Share Improve this question asked Jun 19, 2015 at 2:09 devwannabedevwannabe 3,2108 gold badges44 silver badges82 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 16

You can simply achieve your goal by doing this

accept=".txt"

<input ui-jq="filestyle" type="file" nv-file-select="" accept=".txt" uploader="uploader" data-icon="false" data-classButton="btn btn-default" data-classInput="form-control inline v-middle input-s" multiple>

more information

发布评论

评论列表(0)

  1. 暂无评论