Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php BlueImp jQuery文件上载-向每个文件添加添加数据_Php_Jquery_File Upload_Blueimp - Fatal编程技术网

Php BlueImp jQuery文件上载-向每个文件添加添加数据

Php BlueImp jQuery文件上载-向每个文件添加添加数据,php,jquery,file-upload,blueimp,Php,Jquery,File Upload,Blueimp,我最近承担了一个项目,创建一个简单的多文件上传系统,您可以为上传的每个文件分配一个标题。现在我被推荐使用Blueimp的jQuery文件上传程序,因为它提供了拖放功能 这就是我感到困惑的地方。我已经看过blueimp在GitHub上给出的教程或描述。我可以添加一个额外的字段,但这适用于所有上传的文件。(我使用CodeIgniter将文件处理到DB) 那么,我该如何为添加的每个文件添加一个单独的标题呢?因为我无法理解github上的tut。(可能是一个JSFIDLE示例,我可以从中学习?) 编辑*

我最近承担了一个项目,创建一个简单的多文件上传系统,您可以为上传的每个文件分配一个标题。现在我被推荐使用Blueimp的jQuery文件上传程序,因为它提供了拖放功能

这就是我感到困惑的地方。我已经看过blueimp在GitHub上给出的教程或描述。我可以添加一个额外的字段,但这适用于所有上传的文件。(我使用CodeIgniter将文件处理到DB)

那么,我该如何为添加的每个文件添加一个单独的标题呢?因为我无法理解github上的tut。(可能是一个JSFIDLE示例,我可以从中学习?)

编辑*

现在我已经设法添加了额外的输入框…最后添加起来相当简单(doh!)。这就是我在index.html文件中的内容

<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-upload fade">
        <td>
            <span class="preview"></span>
        </td>
        <td>
            <p class="name">{%=file.name%}</p>
            {% if (file.error) { %}
                <div><span class="label label-important">Error</span> {%=file.error%}</div>
            {% } %}
        </td>
        <td class="title"><label>File Title: <input name="title[]" required="required"></label></td>
        <td>
            <p class="size">{%=o.formatFileSize(file.size)%}</p>
            {% if (!o.files.error) { %}
                <div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="bar" style="width:0%;"></div></div>
            {% } %}
        </td>
        <td>
            {% if (!o.files.error && !i && !o.options.autoUpload) { %}
                <button class="btn btn-primary start">
                    <i class="icon-upload icon-white"></i>
                    <span>Start</span>
                </button>
            {% } %}
            {% if (!i) { %}
                <button class="btn btn-warning cancel">
                    <i class="icon-ban-circle icon-white"></i>
                    <span>Cancel</span>
                </button>
            {% } %}
        </td>
    </tr>
{% } %}
</script>

我的下一个问题是,现在如何将标题指定为文件名

只需添加file.name(不带扩展名)作为文本字段的值

文件标题:
$('#fileupload').bind('fileuploadsubmit', function (e, data) {
    var inputs = data.context.find(':input');
    if (inputs.filter('[required][value=""]').first().focus().length) {
        return false;
    }
    data.formData = inputs.serializeArray();