php - summernote image upload and alternative not working -


i using summernote editor on site , have implemented using click2edit method mentioned on site here.

however image upload if used causes sorts of problems. understanding using called base64. tried replace more straight forward file upload server using code stackoverflow answer [here]. (summernote image upload) doesn't seem doing anything, image still gets inserted original method. if me work out how correctly implement this.

in terms of error, site has several tabs, 1 of tabs includes click2edit summernote editor, when tried , use image upload , save it, picture doesn't display , combines tabs 1 page (likely special character somewhere causes problem?). secondly sql column text datatype shows no content when viewed in sql management studio , content editable, gives kind of saving error. ended needing delete entry return things normal.

my code:

to implement summernote:

<div class="click2edit">click2edit</div>  var edit = function() {  $('.click2edit').summernote({focus: true}); }; var save = function() {   var ahtml = $('.click2edit').code(); //save html if need(ahtml:     array).   $('.click2edit').destroy(); }; 

for file upload using:

$(document).ready(function() {     $('#summernote').summernote({         height: 200,         onimageupload: function(files, editor, weleditable) {             sendfile(files[0], editor, weleditable);         }     });      function sendfile(file, editor, weleditable) {         data = new formdata();         data.append("file", file);         $.ajax({             data: data,             type: "post",             url: "form_summernote_doc_upload_post.php",             cache: false,             contenttype: false,             processdata: false,             success: function(url) {                 editor.insertimage(weleditable, url);             }         });     } }); 

i should mention output being uploaded sql usinga post includes

(stuff)....sql_safe($postarray[text])....(stuff) 

i thought might fact using click2edit method of initiating summernote rather giving straight forward #summernote id. tried , result same. not understand how disable summernotes own method of uploading, maybe overriding. thanks

summer note new version passes 1 argument. can use script

$('.summer').summernote({     height: "200px",     callbacks: {         onimageupload: function(files) {             url = $(this).data('upload'); //path defined data attribute  textarea             sendfile(files[0], url, $(this));         }     } });  function sendfile(file, url, editor) {     var data = new formdata();     data.append("file", file);     $.ajax({         data: data,         type: "post",         url: url,         cache: false,         contenttype: false,         processdata: false,         success: function(objfile) {             editor.summernote('insertimage', objfile.folder+objfile.file);         },         error: function(jqxhr, textstatus, errorthrown) {         }     }); } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -