1

我想强制用户使用 plupload 只上传横向文件。

我还没有看到任何过滤器(仅适用于文件类型)能够做到这一点。

这是我的代码:

    var initUploader = function () {
    $("#uploader").pluploadQueue({
        // General settings
        runtimes : 'html5,gears,flash,silverlight,browserplus',
        url : 'http://xxx',
        max_file_size : '10mb',
        chunk_size : '1mb',
        unique_names : true,

        // Resize images on clientside if we can
        resize : {width : 320, height : 240, quality : 90},

        // Specify what files to browse for
        filters : [
            {title : "Image files", extensions : "jpg,gif,png"}
        ],

        // Flash settings
        flash_swf_url : '/js/plupload/js/plupload.flash.swf',

        // Silverlight settings
        silverlight_xap_url : '/js/plupload/js/plupload.silverlight.xap',

        // send extra parameters :
        multipart_params : {
            'title': 'Picture title',
            'pictureCategory': 'Banniere',
            'vigneronID': $('#vigneron_id').val()
        },
        init: {
            FilesAdded: function (up, files) {
                alert('Selected files: ' + files.length);
            },
            UploadComplete: function (up, files) {
                // destroy the uploader and init a new one
                up.destroy();
                initUploader();
            }
        }
    });
};

如果在我提醒文件长度的初始化部分中,我可以访问宽度/高度属性以检测文件方向,然后允许或不将其添加到队列中。

plupload 文件 API ( http://www.plupload.com/plupload/docs/api/index.html#class_plupload.File.html ) 似乎没有提供这些属性!

感谢您的任何建议。

4

0 回答 0