3

我正在寻找使用 Fineuploader 为每个上传的项目添加标题/名称。每个附件都会在其旁边显示一个文本框,以便用户可以在按“上传”之前输入标题/名称,如下所示

我看过了,每个上传请求都会发送类似

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();
}); 

});

4

1 回答 1

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();
});
于 2013-03-22T12:46:32.563 回答