1 1<!doctype html>
2 2<html>
3 3 <head>
4 4 <meta charset="utf-8" />
5 5 <title>Upload Button Examples</title>
6 6 <link rel="stylesheet" href="../themes/default/default.css" />
7 7 <script src="../kindeditor-min.js"></script>
8 8 <script>
9 9 KindEditor.ready(function(K) {
1010 var uploadbutton = K.uploadbutton({
1111 button : K('#uploadButton')[0],
1212 fieldName : 'imgFile',
1313 url : '../php/upload_json.php?dir=file',
1414 afterUpload : function(data) {
1515 if (data.error === 0) {
1616 var url = K.formatUrl(data.url, 'absolute');
1717 K('#url').val(url);
1818 } else {
1919 alert(data.message);
2020 }
2121 },
2222 afterError : function(str) {
2323 alert('???????: ' + str);
2424 }
2525 });
2626 uploadbutton.fileBox.change(function(e) {
2727 uploadbutton.submit();
2828 });
2929 });
3030 </script>
3131 </head>
3232 <body>
3333 <div class="upload">
3434 <input class="ke-input-text" type="text" id="url" value="" readonly="readonly" /> <input type="button" id="uploadButton" value="Upload" />
3535 </div>
3636 </body>
3737</html>
38