How to make uploading images to server in Summernote editor?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
19 views
It is impossible to implement loading the image on the server. Found solution in Internet, but they don't work for me.
by | 19 views

1 Answer

0 like 0 dislike
spoiler
$(document).ready(function() { $('#summernote').summernote({ callbacks: { onImageUpload: function(files, editor, $editable) { sendFile(files[0],editor,$editable); } } }); sendFile = function(file, editor, welEditable) { data = new FormData(); data.append("file", file); $.ajax({ url: '/summernote.php', data: data, cache: false, contentType: false, processData: false, type: 'POST', success: function(data){ console.log(data); $('#description').summernote("editor.insertImage", data, 'filename'); }, error: function(jqXHR, textStatus, errorThrown) { console.log(textStatus+" "+errorThrown); } }); } });

by

Related questions

0 like 0 dislike
7 answers
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
110,608 questions
257,187 answers
0 comments
40,796 users