【问题标题】:Plupload Onload show list of uploaded filesPlupload Onload 显示上传文件列表
【发布时间】:2014-11-09 20:37:53
【问题描述】:

我正在使用 Plupload 文件插件http://www.plupload.com/。我花了很多时间在谷歌和论坛上搜索它,但没有找到。我还阅读了此插件的文档,但没有运气。我的问题是我想在窗口加载时显示所有以前上传的图像。这是我的代码请让我知道那里是否有可能或选项,谢谢:

<pre>
$("#uploader").plupload({
    // General settings
    runtimes: 'html5,flash,silverlight,html4',
    //url: {{ URL::asset('assets/js/plupload-2.1.2/examples/upload.php') }},
    //url: '../upload.php',
    url: "{{ URL::asset('assets/js/plupload-2.1.2/examples/upload.php') }}",
    // User can upload no more then 20 files in one go (sets multiple_queues to false)
    max_file_count: 200,
    chunk_size: '200mb',
    // Resize images on clientside if we can
    //            resize: {
    //                width: 200,
    //                height: 200,
    //                quality: 90,
    //                crop: false // crop to exact dimensions
    //            },
    filters: {
    // Maximum file size
        max_file_size: '1000mb',
        // Specify what files to browse for
        mime_types: [
            {title: "Image files", extensions: "jpg,gif,bmp,png"}
        ]
    },
    // Rename files by clicking on their titles
    rename: false,
    // Sort files
    sortable: true,
    // Enable ability to drag'n'drop files onto the widget (currently only HTML5 supports that)
    dragdrop: true,
    // Views to activate
    views: {
        list: true,
        thumbs: true, // Show thumbs
        active: 'thumbs'
    },
    // Flash settings
    flash_swf_url: "{{ URL::asset('assets/js/plupload-2.1.2/js/Moxie.swf') }}",
    // Silverlight settings
    silverlight_xap_url: "{{ URL::asset('assets/js/plupload-2.1.2/js/Moxie.xap') }}"
});
</pre>

【问题讨论】:

  • 您不需要 plupload 来显示现有图像,只需使用它来传输它们。可以这样想……实际文件已发送到服务器,因此 plupload 无法再对其进行任何操作
  • 有一个可用的插件 [blueimp file upload] 提供此功能,但我不喜欢他们的界面。
  • plupload 插件有一个很好的界面,它适合我的需要。应该也有这个功能。
  • 好的,您必须使用具有所有花里胡哨和桌面显示的那个。为现有图像复制相同的样式。做起来应该不会太难。我经常使用 plupload,但创建自己的进度条和回调

标签: php jquery html jquery-plugins plupload


【解决方案1】:

pl 上传有 init 选项,在此选项下您可以修改文件上传方法,如...

$("#uploader").plupload({
....
....
    init: {
                FilesAdded: function (up, files) {

                },
                FileUploaded: function (up, file, response) {

                },
                UploadComplete: function (up, files) {

                }
                .....
            }

});

您可以使用这些方法将您上传的文件放入您的列表中。

【讨论】:

  • 您好 Azadrum,感谢您的回复。如何使用 FileUploaded: 链接到我的文件夹?有什么想法吗?是否有可用于此任务的事件或方法?
  • FileUploaded 方法的“response”参数是你的upload.php 的结果。因此,如果您从 upload.php 返回上传图片的路径,您可以使用它来渲染上传的图片
  • 在没有反馈的情况下投反对票对任何人都没有帮助。至少说明答案有什么问题,以便为问题制定更好的答案。
猜你喜欢
  • 2012-09-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-12-14
  • 1970-01-01
  • 2016-09-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多