简体   繁体   English

jQuery文件上传

[英]jQuery file upload

I am using the Jquery file upload widget, http://blueimp.github.com/jQuery-File-Upload/ 我正在使用Jquery文件上传小部件http://blueimp.github.com/jQuery-File-Upload/

I managed to get all the images to my database the way i wanted but i'm not able to view only the images that i want. 我设法将所有图像以所需的方式保存到数据库中,但是我无法仅查看所需的图像。 in the index page it views all the images in the "files" folder. 在索引页面中,它查看“文件”文件夹中的所有图像。

I'm making an image gallery with multiple albums. 我正在制作包含多个相册的图片库。

照片表

The image above shows my photos table. 上图显示了我的照片表。 i have the name of the image and a number (in_album) telling me which album it's in. when I go to www.example.com/gallery.php/album?12 for example i want only those photos that have in_album = 12 viewed, not all the photos in the folder. 我有图像的名称和一个数字(in_album)告诉我它所在的相册。例如,当我访问www.example.com/gallery.php/album?12时,我只希望查看in_album = 12的那些照片,而不是文件夹中的所有照片。 i think i need to use JSON or something to achieve this, but i'm not sure. 我认为我需要使用JSON或某种方式来实现此目的,但我不确定。

Not useful, but it works: 没有用,但是可以工作:

    <!-- 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++) { %}


        {% if (file.in_album == '12') { %}


        <tr class="template-download fade">
            <td>
                <span class="preview">
                    {% if (file.thumbnailUrl) { %}
                        <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
                    {% } %}
                </span>
            </td>
            <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" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
                        <i class="glyphicon glyphicon-trash"></i>
                        <span>Delete</span>
                    </button>
                    <input type="checkbox" name="delete" value="1" class="toggle">
                {% } else { %}
                    <button class="btn btn-warning cancel">
                        <i class="glyphicon glyphicon-ban-circle"></i>
                        <span>Cancel</span>
                    </button>
                {% } %}
            </td>
        </tr>
                    {% } %}


    {% } %}
    </script>

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

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