/ShenLanCMS/ShenLanCMS.Web/Addons/kindeditor/examples/uploadbutton.html
HTML | 37 lines | 37 code | 0 blank | 0 comment | 0 complexity | e3950a37ca842a0e7d8885e6d1503f3e MD5 | raw file
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title>Upload Button Examples</title>
- <link rel="stylesheet" href="../themes/default/default.css" />
- <script src="../kindeditor-min.js"></script>
- <script>
- KindEditor.ready(function(K) {
- var uploadbutton = K.uploadbutton({
- button : K('#uploadButton')[0],
- fieldName : 'imgFile',
- url : '../php/upload_json.php?dir=file',
- afterUpload : function(data) {
- if (data.error === 0) {
- var url = K.formatUrl(data.url, 'absolute');
- K('#url').val(url);
- } else {
- alert(data.message);
- }
- },
- afterError : function(str) {
- alert('???????: ' + str);
- }
- });
- uploadbutton.fileBox.change(function(e) {
- uploadbutton.submit();
- });
- });
- </script>
- </head>
- <body>
- <div class="upload">
- <input class="ke-input-text" type="text" id="url" value="" readonly="readonly" /> <input type="button" id="uploadButton" value="Upload" />
- </div>
- </body>
- </html>