69 lines
2.6 KiB
PHTML
69 lines
2.6 KiB
PHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>数据上传</title>
|
|
<link rel="stylesheet" type="text/css" media="screen" href="/css/default.css" />
|
|
<script src='/static/js/jquery-1.7.2.min.js' type="text/javascript"></script>
|
|
<script type="text/javascript" src="/static/js/uploadify/swfobject.js"></script>
|
|
<script type="text/javascript" src="/static/js/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
|
|
<script type="text/javascript" src="/js/jquery.colorbox-min.js"></script>
|
|
<link href="/css/author.css" media="screen" rel="stylesheet" type="text/css"/>
|
|
<link href="/static/js/uploadify/uploadify.css" media="screen" rel="stylesheet" type="text/css" />
|
|
<link href="/css/colorbox.css" media="screen" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!-- 页面内容 -->
|
|
<div id="wapper">
|
|
<form id="fileUpdate" method="post">
|
|
<p>注:要更新的文件只能选择一个<br />
|
|
<ul id="datalist"></ul>
|
|
<input id="file_upload" name="Filedata" type="file" />
|
|
<input type="button" class="btn btn-small btn-green" onclick="$('#file_upload').uploadifyUpload();" value="更改" />
|
|
</p>
|
|
</form>
|
|
</div>
|
|
<!-- //页面内容 -->
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#file_upload').uploadify({
|
|
'uploader' : '/static/js/uploadify/uploadify.swf',
|
|
'scriptData': {'PHPSESSID' : '<?php echo session_id(); ?>','submit':'1'},
|
|
'script' : '/admin/data/attachments/attupdate/<?php echo $this->id ?>',
|
|
'folder' : '/uploads',
|
|
'multi' : false,
|
|
'auto' : false,
|
|
'displayData' : 'speed',
|
|
'buttonImg' : '/static/js/uploadify/selectfile.gif',
|
|
'onComplete' : function(event, ID, fileObj, response, data) {
|
|
var obj = jQuery.parseJSON(response);
|
|
var html;
|
|
if(obj.error=='')
|
|
{html = obj.html;}else{html = obj.error;}
|
|
$('<li/>', {
|
|
"id":'uploadedItem_'+obj.attid,
|
|
"class":'uploadifyQueueItem',
|
|
"html": html
|
|
}).appendTo('#datalist');
|
|
if(obj.ok!=null)
|
|
{
|
|
Alert('文件修改成功!');
|
|
setTimeout("parent.$.fn.colorbox.close();parent.window.location.href=parent.window.location.href;",2000);
|
|
}
|
|
},
|
|
'onError' : function (event,ID,fileObj,errorObj) {
|
|
alert(errorObj.type + ' Error: ' + errorObj.info);
|
|
}
|
|
});
|
|
});
|
|
function Alert(html){
|
|
$.colorbox({'innerWidth':'50%','html':'<h4>'+html+'</h4>'});
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|
|
|