如何向使用plupload库上传的文件添加信息?

时间:2019-02-11 06:40:22

标签: javascript jquery html ajax

$('.plupload').pluploadQueue({
  runtimes: 'html5,gears,flash,browserplus',
  url: '/uploads/upload?_id=' + $('#fax_id').val(),
  max_file_size: '100mb',
  chunk_size: '1mb',
  sortable: true,
  filters: [{
      title: "Image File",
      extensions: "jpg,gif,png,jpeg,tiff,tif,bmp"
    },
    {
      title: "Document File",
      extensions: "pdf,xls,xlsx,ppt,pptx,doc,docx,txt,rtf"
    }
  ],
  flash_swf_url: 'js/plupload/plupload.flash.swf',
  silverlight_xap_url: 'js/plupload/plupload.silverlight.xap',
  init: {
    FileUploaded: function(up, file, info) {},
    Error: function(up, args) {
      return false;
    }
  }
});

我想使用plupload库上传文件。并且还必须将一些文本添加到上传的文件中。可能吗?预先谢谢你。

1 个答案:

答案 0 :(得分:0)

您可以使用multipart_params随每个上传请求一起传递其他字段。

$('.plupload').pluploadQueue({
  ...
  multipart_params: {
    data: 'This is a text'
  }
});

更多信息:
https://www.plupload.com/docs/v2/Options#multipart https://www.plupload.com/docs/v2/Options#multipart_params