uploadify修改按钮颜色及改变浏览文字,上传完成后自动跳转
<link href="css/default.css" rel="stylesheet" type="text/css" />
<link href="css/uploadify.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="scripts/swfobject.js"></script>
<script type="text/javascript" src="scripts/jquery.uploadify.v2.1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#uploadify").uploadify({
'uploader' : 'scripts/uploadify.swf',
'script' : 'scripts/uploadify.php',
'cancelImg' : 'images/cancel.png',
//'folder' : 'uploadfile/<?=date("Ymd",strtotime("now"))?>/',
'folder' : 'uploadfile/',
'queueID' : 'fileQueue',
'fileExt' : '*.jpg;*.gif;*.bmp', //允许文件上传类型,和fileDesc一起使用.
'fileDesc' : '*.jpg;*.gif;*.bmp', //将不允许文件类型,不在浏览对话框的出现.
'auto' : false,
'multi' : true,
'buttonImg' : 'images/browser.png',
'wmode' : 'transparent' ,
'checkExisting' : true,
'removeCompleted': false,
'onComplete':function(event,queueId,fileObj,response,data){
//$('#info').text($('#info').text() + '<img src="'+response+'">\r');//在页面上显示文件相对路径
$('#info').val($('#info').val()+response+',');//在页面上显示文件相对路径
//return false;
//alert("完成");
}, 'onAllComplete' : function(event,data) {
//alert("全部完成");
$.ajax({
"type":"post",
cache: false,
url: "index.php?c=index&m=uploadPic&fresh="+Math.random(),
async: false,
data:{"album_id":1,"comment":$("#info").val()},
success: function(str){
}
});
window.location = "index.php?c=index&m=viewPic&album_id=1&member_id=1";
}
});
});
</script>
<div id="container">
<div id="fileQueue"></div>
<div class="btn-group">
<input type="hidden" name="album_id" id="album_id" value="1" />
<input type="file" name="uploadify" id="uploadify" />
<a href="javascript:jQuery('#uploadify').uploadifyUpload()" class="btn" onclick="/*$('#myform').submit();*/">上 传</a>
</div>
<div id="2info"><input type=hidden name="comment" id="info"></div>
</div>
</td>
</tr>
</table>