如何在BlueImp jQuery下载程序中过滤要下载的文件
how can I filter the files for download in the blueimp jquery download program
我正在尝试使用Blueimp jQuery文件上传文件程序 https://github.com/blueimp/jQuery-File-Upload。我已经搜索了wiki和文档,但找不到如何过滤可供下载的文件的答案。
我在经过身份验证的"受保护"区域内使用它。我已经成功地在我上传的所有文件前面加上一个唯一的 id(例如 UID 文件名.jpg ),我将在经过身份验证的会话中提供该 ID。所以我所要做的就是只选择具有正确 UID 的那些。
显示下载表的 jquery 代码是:
<!-- The template to display files available for download -->
<script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<!-- <tr class="template-download fade">-->
<tr class="template-download ">
{% if (file.error) { %}
<td></td>
<td class="name"><span>{%=file.name%}</span></td>
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
{% } else { %}
<td class="preview">{% if (file.thumbnail_url) { %}
<a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
{% } %}</td>
<td class="name">
<a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
</td>
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
<td colspan="2"></td>
{% } %}
<td class="delete">
<button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
<i class="icon-trash icon-white"></i>
<span>{%=locale.fileupload.destroy%}</span>
</button>
<input type="checkbox" name="delete" value="1">
</td>
</tr>
我在JS/Jquery方面不是很有经验。我将不胜感激关于下一步该做什么的任何想法。是否有人熟悉过滤这些文件的设置/选项。或者,我假设该文件是我怀疑可以过滤的文件名或路径数组。在PHP中,我可能会使用glob函数。有人在JS中对此有任何经验吗?
提前谢谢你,
法案
使用插件 http://sunnywalker.github.io/jQuery.FilterTable/它适用于任何表,并且易于部署。
包括依赖项:
<script src="/path/to/jquery.js"></script>
<script src="/path/to/bindWithDelay.js"></script> <!-- optional -->
<script src="/path/to/jquery.filtertable.js"></script>
<style>
.filter-table .quick { margin-left: 0.5em; font-size: 0.8em; text-decoration: none; }
.fitler-table .quick:hover { text-decoration: underline; }
td.alt { background-color: #ffc; background-color: rgba(255, 255, 0, 0.2); }
</style> <!-- or put the styling in your stylesheet -->
输入代码
<script>
$('table').filterTable(); //if this code appears after your tables; otherwise, include it in your document.ready() code.
</script>
好!祝你好运!
相关文章:
- 如何在生成下载文件时显示加载动画
- 有可能过滤来自嵌入式YouTube的声音吗
- 直接下载文件,而不是从window.open(url)
- 如何使用javascript或html下载PDF格式的填写表单
- Javascript运行php文件,然后下载文件
- 在单击href链接的同时下载文件
- 尽管链接成功并已成功下载,但未找到NPM模块
- 通过php页面中的js强制下载txt
- 为什么我的d3.jsselectAll+过滤器没有过滤
- 使用angularjs向浏览器发送servlet响应(下载功能)
- 通过javascript下载文件时设置文件名
- 如何在Edge中下载图像/png数据URI
- 下载使用POST数据动态生成的文件
- 在提交时打开thankyou.html+下载PDF
- HTML锚标记无法在android平台中下载文件
- PERL-下载CSV文件不完整
- ui网格日期单元格过滤器,过滤日期格式导致显示错误的日期
- 将下载链接从web浏览器传递给第三方应用程序
- Angular:使用选择列表选择过滤代码中的对象
- 如何在BlueImp jQuery下载程序中过滤要下载的文件