我正在尝试设计一个我正在使用Uploadify的多文件上传器。我将有 5 个上传按钮。我想要的是启用第一个,而在页面加载时禁用其他 4 个。在第一个按钮中成功上传文件后,应启用第二个按钮,依此类推。
我试过搜索,但有一些帖子建议隐藏上传者(高度 = 0)。
我在准备好的功能中尝试过这样的事情
$('#FileUpload2').fileUpload('enabled', false);
$('#FileUpload3').fileUpload('enabled', false);
$('#FileUpload4').fileUpload('enabled', false);
$('#FileUpload5').fileUpload('enabled', false);
我不确定这是否正确。我试图尽可能清楚地说明这一点。如果可能,请为我提供替代解决方案。
更新
这是完整的代码
<head runat="server">
<title></title>
<link rel="Stylesheet" type="text/css" href="CSS/uploadify.css" />
<script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="scripts/jquery.uploadify.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div style = "padding:40px">
<asp:FileUpload ID="FileUpload1" runat="server" />
</div>
<div id="fu2" style = "padding:40px;">
<asp:FileUpload ID="FileUpload2" runat="server" />
</div>
<ul id="appendImg">
</ul>
</form>
</body>
</html>
<script type = "text/javascript">
$(document).ready(function () {
// put all your jQuery goodness in here.
$("#<%=FileUpload2.ClientID%>").uploadify('disable', true);
});
$(window).load(
function () {
$("#<%=FileUpload1.ClientID%>").fileUpload({
'uploader': 'scripts/uploader.swf',
'uploadLimit': 3,
'cancelImg': 'images/cancel.png',
'buttonText': 'Browse Files',
'script': 'Upload.ashx',
'folder': 'uploads',
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
'multi': false,
'auto': true,
'onComplete': function (event, queueID, fileObj, response, data) {
//alert(fileObj.filePath);
// $('#kk').attr('src', "" + fileObj.filePath + "");
var html = '';
html += '<li><img src="' + fileObj.filePath + '" alt="" style="width:100px;height:100px;" /></li>';
$('#appendImg').append(html);
//$('#fu2').attr('style', 'padding:40px;display:block;');
},
'onAllComplete': function (event, queueID, fileObj, response, data) {
},
'onUploadSuccess': function (file, data, response) {
$('#FileUpload1').uploadify('settings', 'height', 0);
$('#FileUpload1').uploadify('settings', 'width', 0);
$('#FileUpload2').uploadify('settings', 'height', 400);
$('#FileUpload2').uploadify('settings', 'width', 400);
}
});
$("#<%=FileUpload2.ClientID%>").fileUpload({
'uploader': 'scripts/uploader.swf',
'uploadLimit': 3,
'cancelImg': 'images/cancel.png',
'buttonText': 'Browse Files',
'script': 'Upload.ashx',
'folder': 'uploads',
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
'multi': false,
'auto': true,
'setDisabled':true,
'onComplete': function (event, queueID, fileObj, response, data) {
//alert(fileObj.filePath);
// $('#kk').attr('src', "" + fileObj.filePath + "");
var html = '';
html += '<li><img src="' + fileObj.filePath + '" alt="" style="width:100px;height:100px;" /></li>';
$('#appendImg').append(html);
},
'onAllComplete': function (event, queueID, fileObj, response, data) {
}
});
}
);
</script>