PageRenderTime 12ms CodeModel.GetById 7ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/ShenLanCMS/ShenLanCMS.Web/Addons/kindeditor/examples/uploadbutton.html

http://xianshihai.codeplex.com
HTML | 37 lines | 37 code | 0 blank | 0 comment | 0 complexity | e3950a37ca842a0e7d8885e6d1503f3e MD5 | raw file
 1<!doctype html>
 2<html>
 3	<head>
 4		<meta charset="utf-8" />
 5		<title>Upload Button Examples</title>
 6		<link rel="stylesheet" href="../themes/default/default.css" />
 7		<script src="../kindeditor-min.js"></script>
 8		<script>
 9			KindEditor.ready(function(K) {
10				var uploadbutton = K.uploadbutton({
11					button : K('#uploadButton')[0],
12					fieldName : 'imgFile',
13					url : '../php/upload_json.php?dir=file',
14					afterUpload : function(data) {
15						if (data.error === 0) {
16							var url = K.formatUrl(data.url, 'absolute');
17							K('#url').val(url);
18						} else {
19							alert(data.message);
20						}
21					},
22					afterError : function(str) {
23						alert('???????: ' + str);
24					}
25				});
26				uploadbutton.fileBox.change(function(e) {
27					uploadbutton.submit();
28				});
29			});
30		</script>
31	</head>
32	<body>
33		<div class="upload">
34			<input class="ke-input-text" type="text" id="url" value="" readonly="readonly" /> <input type="button" id="uploadButton" value="Upload" />
35		</div>
36	</body>
37</html>