写真をアップロードするための比較的完全な夏のケースでは、背景はありません(オンラインで写真をアップロードするケースは多すぎます)。フロントエンドJSのみです。オンラインで提供されるコードはバグが付いています。
この例では、JSはエラーを保証しません。個人テストが利用可能
<%@ページ言語= "java" contentType = "text/html; charset = utf-8" pageencoding = "utf-8"%> <! href = "// netdna.bootstrappcdn.com/bootstrap/3.0.1/css/bootstrap.min.css" rel = "styleSheet" type = "text/css"> <スクリプトsrc = "// netdna.bootstrappcdn.com/bootstrap/3.0.1/js/boottrap.min.js"></script> <link href =" // netdna.bootstrappcdn.com/font-awefee/4.0.3/css/ type = "text/css"> <! - must-> <link href = "summernote-master/dist/summernote.css" rel = "styleSheet" type = "text/css"> <! - script src = "summernote-master/dist/summernote.js"> < src = "summernote-master/lang/summernote-zh-cn.js"> </script> <title> bootstrap-markdown </title> <style> .note-alarm {note-alarm {right; margin-top:10px; margin-right:10px;} </style> </head> <body> <divid = </divernote "> </diver type = "text /javascript"> $(document).ready(function(){ /* function sendfile(file、editor、weleditable){console.log( "file ="+file); console.log( "editor ="+editor); console.log( "weleditable ="+weleditable); $ .ajax({url: 'blog_images.jsp'、data、cache:false、contenttype:false、false、type: 'post'、function(data){editor.insertimage(weleditable、data.url);}}}); 'zh-cn'、//デフォルト: 'en-us' focus:true、toolbar:['style'、['bold'、 'italic'、 'underline'、 'clear']]、['fontsize'、['fontsize']]、['color、[' color ']、[' para ']、' ol ']、' ol ']、' ol ']、[' color ']、 ['insert'、 'picture'、 'video']]、 /*{selectfromfiles: 'select file'}、* / /*onimageupload:function(files、editor、welleditable){sendfile [0]、editor、editor、weleditable); $ editable);}); function sendfile(file、editor、$ editable){$( "。note-toolbar.btn-toolbar")。 false;} if(!filename){$( "。note-alarm") Timestamp+"_"+$( "#summernote")。援助は、ファイルユーザーを区別するために追加した属性です。 data = new formdata(); data.append( "file"、file); data.append( "key"、name); data.append( "token"、$( "#summernote")。 http形式のコンテンツ:false、false:function(data)は、ハッシュ、キーなどの返された値ですこのステップloading "); settimeout(function(){$("。note-alarm ")。remaid();}、3000);}、error:function(){$("。note-alarm ")。html(" upload failed "); setimeout(function(){$("。note-alarm ")。remaid();}、3000);}});} </script> </body> </html>上記の記事は、エラーを報告しない単純な夏の画像アップロードケースです。これは私があなたと共有するすべてのコンテンツです。参照を提供できることを願っています。wulin.comをもっとサポートできることを願っています。