从数据库加载数据并通过jquery文件上传插件显示它们

问题描述

我已经使用blueimp/jQuery-File-Upload上传文件并将每个上传文件的元数据保存在数据库中。

用户通过新页面请求随时返回页面时,所有元数据均从数据库加载并通过插件显示

以下是可能的部分解决方案和问题:

是否可以从后端返回数据并加载template-download,以便显示所有文件

<script id="template-download" type="text/x-tmpl">
    {% for (var i=0,file; file=o.files[i]; i++) { %}
    <tr class="template-download fade{%=file.thumbnailUrl?' image':''%}">
        <td>
            <p class="name">
                {% if (file.url) { %}
                <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
                {% } else { %}
                <span>{%=file.name%}</span>
                {% } %}
            </p>
            {% if (file.error) { %}
            <div><span class="label label-danger">Error</span> {%=file.error%}</div>
            {% } %}
        </td>
        <td>
            <span class="size">{%=o.formatFileSize(file.size)%}</span>
        </td>
        <td>
            {% if (file.deleteUrl) { %}
            <button class="btn btn-danger delete btn-sharp" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}" {% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}' {% } %}>
                <span>Delete</span>
            </button>
            {% } else { %}
            <button class="btn btn-warning cancel">
                    <span>Cancel</span>
                </button>
            {% } %}
        </td>
    </tr>
    {% } %}
</script>

更新

以下链接似乎有答案。但是我需要检查。

How to load the file data to download template on page refresh in blueimp jquery file upload

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)