只允许angular-file-upload模块中的特定文件扩展名可单击 [英] Only allow specific file extensions in angular-file-upload module to be clickable

查看:99
本文介绍了只允许angular-file-upload模块中的特定文件扩展名可单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此模块, https://github.com/nervgh/angular-file -upload

我正在使用他们的简单例子, http://nervgh.github.io/pages/angular-file-upload/examples/simple/

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?

例如,在配置中,我们只允许.txt扩展名,当我点击选择文件按钮时,它会打开一个窗口并显示所有文件。但是,没有扩展名.txt的文件将被禁用。

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.

出于安全考虑,我不这样做。我只是按照提供的设计/说明进行操作。 :)我总是可以使用mitm工具拦截并允许上传其他扩展。

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.

推荐答案

您可以通过以下方式实现目标:这样做

You can simply achieve your goal by doing this

接受=。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>

更多信息

这篇关于只允许angular-file-upload模块中的特定文件扩展名可单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆