【问题标题】:Jquery MultiFileUpload with file description带有文件描述的 Jquery MultiFileUpload
【发布时间】:2015-10-07 06:52:47
【问题描述】:

我一直在寻找一个带有文件描述的 jquery 多文件上传。

我找到了类似的例子

pluupload

uploadify

https://blueimp.github.io/jQuery-File-Upload/

但我在任何上传器中都找不到可以对特定文件进行描述的地方?

如果有人遇到过带有文件描述的此类上传器或任何文件上传器,我该如何扩展以使用文件描述

【问题讨论】:

    标签: jquery file-upload multifile-uploader


    【解决方案1】:

    使用 dropzone 或 blueimp,将字段添加到上传处理程序非常简单。

    这是我的一个带有额外发布数据的 dropzone 脚本的准系统

    .bind() 函数是将字段添加到提交的地方

    $('#drop_zone_outer_div').fileupload({ // This element will accept file drag/drop uploading autoUpload: true, dropZone: $('#drop_div_id'), limitMultiFileUploads:1, maxNumberOfFiles: 1, fileInput: $('#input_field_id'), url: 'url_to_file', dataType: 'text', // This function is called when a file is added to the queue; // either via the browse button, or via drag/drop: add: function (e, data) { var tpl = $('<li class="working"><p></p></li>'); // Append the original file name and file size tpl.find('p').text("Submitted File: " + data.files[0].name).append(' <i>' + formatFileSize(data.files[0].size) + '</i>'); // Add the HTML to the UL element data.context = $(ul).html(tpl); // upload the file on btn click $('#btnSubmit').click(function(){ var jqXHR = data.submit();}) }, progressall: function (e, data) { }, done: function(e, data){ } }).bind('fileuploadsubmit', function (e, data) { data.formData = { name: $('#upload_name_input').val(), comment: $('#comment_id').val(), other: $('#other_input').val() }; }); </script> </code> </pre>

    【讨论】:

    • 我需要类似选择文件上传然后它应该显示文件名评论文本区域然后一个勾号和关闭按钮
    • 是否设置为异步上传?还是点击提交按钮?
    • 点击提交按钮
    • 你能发布一些你试过的代码吗?你已经拥有了什么?所有这些插件都可以接受额外的数据
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-16
    • 1970-01-01
    • 1970-01-01
    • 2016-03-07
    • 2012-11-27
    相关资源
    最近更新 更多