$(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"); 后就没错了 但是这样子不好呀 无缘无故弹个窗
问下 你得可以根据ID还改变'fileExt'这个值吗? 我按照你这样写 报错 对象不支持uploadifySettings 这个方法
请问你是怎么解决的
新版本不支持uploadifySettings了吧,请换uploadify("settings", key,value);