user51441
4
Q:

allintitle:uploadbutton html

 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>
0

New to Communities?

Join the community