首页 新闻 会员 周边 捐助

jquery uploadify 根据参数改变fileExt的值

0
[已关闭问题] 关闭于 2012-04-09 17:45

$(document).ready(function () {
    $("#uploadify").uploadify({
        'uploader': '../JS/jquery.uploadify-v2.1.4/uploadify.swf',
        'script': 'UploadHandler.ashx?ASPSESSID=<%=Session.SessionID %>',
        'folder': 'UploadFile',
        'queueID': 'fileQueue',
        'buttonImg': '../images/Site/browse-1.jpg ',
        'width': 70,
        'height': 23,
        'fileExt': '*.jpg;*.gif;*.png;',
        'fileDesc': '请选择jpg,jpeg,gif,png格式',
        'auto': false,
        'multi': true,
        'queueSizeLimit': 50,
        'sizeLimit': 1024 * 160,
        'onSelect': function (e, queueId, fileObj) {
            $("#valiuploadify").hide();
        },
        onComplete: function (event, ID, fileObj, response, data) {
            //$("#retImg").append("<img class='imgcls' src='" + response + "'/>");
            // $("#imgDishAdd").attr("src", "../upload/dishphoto/" + response).show(); 

            //将图片名称存到隐藏域中,用于提交时的数据传输 

            //$("#hfImgName").val(response);
        },
        onAllComplete: function (event, data) {
            //alert(data.filesUploaded);
            // __doPostBack('<%=btnCommit2Server.ClientID %>', '');
            commitForm();
        },
        onError: function () { $.unblockUI(); }
    });

    var thisval = $("input[id$='FileType']").val();

    var desc = "";
    var queueSizeLimit = 50;
    var sizeLimit = 1024 * 160;
    if (thisval == "1") {
        thisval = "*.jpg;*.gif;*.png;*.jpeg;";
        desc = "请选择jpg,jpeg,gif,png格式";
        queueSizeLimit = 50;
        sizeLimit = 1024 * 125;
    }
    else if (thisval == "2") {
        thisval = "*.mdi;*.mp3;";
        desc = "请选择mdi,mp3格式";
        queueSizeLimit = 5;
        sizeLimit = 1024 * 6 * 1024;
    }
    else if (thisval == "3") {
        thisval = "*.txt;*.doc;";
        desc = "请选择txt,doc格式";
        queueSizeLimit = 10;
        sizeLimit = 1024 * 100;
    }
    var upload = $('#uploadify');
    upload.uploadifySettings('fileExt', thisval);
    upload.uploadifySettings('fileDesc', desc);
    upload.uploadifySettings('queueSizeLimit', queueSizeLimit);
    upload.uploadifySettings('sizeLimit', sizeLimit);
});

 

怎么会报错 我在    var upload = $('#uploadify');  后面加个alert("ok"); 后就没错了 但是这样子不好呀 无缘无故弹个窗

meguoling的主页 meguoling | 菜鸟二级 | 园豆:204
提问于:2011-12-21 13:16
< >
分享
所有回答(2)
0

问下 你得可以根据ID还改变'fileExt'这个值吗? 我按照你这样写  报错 对象不支持uploadifySettings 这个方法

  请问你是怎么解决的

贝乐猫 | 园豆:202 (菜鸟二级) | 2012-09-11 10:58
0

新版本不支持uploadifySettings了吧,请换uploadify("settings", key,value);

相忘于江湖 | 园豆:229 (菜鸟二级) | 2013-04-22 21:45
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册