给每个附件一个标题

时间:2013-03-22 12:41:29

标签: fine-uploader

我希望使用Fineuploader为每个上传的项目添加标题/名称。 每个附件都会在其旁边显示一个文本框,以便用户在按“上传”like this

之前输入标题/名称

我看了一下,每个上传请求都发送了类似

的内容
fine.uploader.php?qquuid=f5ff0211-c004-4b1d-8ea7-228d49c4a694&qqtotalfilesize=54&qqfile=DrayTek.txt

如果我可以让它为此添加'& title' - 我有PHP来处理fine.uploader.php上的任何'GETs'

$(document).ready(function() {
var manualuploader = new qq.FineUploader({
  element: $('#manual-fine-uploader')[0],
  request: {
    endpoint: 'fine.uploader.php?parent_type=<?php echo $parent_type; ?>&parent_id=<?php echo $parent_id; ?>&initial=<?php echo $initial; ?>&view=<?php echo $view; ?>&crm_user=<?php echo $crm_user; ?>'
  },
  autoUpload: false,
  text: {
    uploadButton: '<i class="icon-plus icon-white"></i> Add Attachments'
  }
});

$('#triggerUpload').click(function() {
  manualuploader.uploadStoredFiles();
}); 

});

1 个答案:

答案 0 :(得分:2)

查看setParams方法。这将在您的请求中添加设置的参数。

试试这个:

$(document).ready(function() {
    var manualuploader = new qq.FineUploader({
        element: $('#manual-fine-uploader')[0],
        request: {
            endpoint: 'fine.uploader.php'
        },
        autoUpload: false,
        text: {
            uploadButton: '<i class="icon-plus icon-white"></i> Add Attachments'
        }
    });

    $('#triggerUpload').click(function() {

        manualuploader.setParams({
            parent_type: <?php echo $parent_type; ?>, // I am assuming that these are integer values that do not need quotes around them
            parent_id: <?php echo $parent_id; ?>,
            initial: <?php echo $initial; ?>,
            view: <?php echo $view; ?>,
            crm_user: <?php echo $crm_user; ?>
        });

        manualuploader.uploadStoredFiles();
});