Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

flask get summernote text

<form action="/updateTest" method="POST">
 <h1 style="text-align:center">content</h1><textarea name=content id="summernote">{{value}</textarea>
 <input class="input-btn" type="submit" value="Update">
Comment

flask get summernote text

<style>
$(document).ready(function() {
        $('#summernote').summernote({
            height: 300,
            focus: true,
            callbacks: {
                onImageUpload(files) {
                  sendFile(files[0], data => {
                    let imgNode = document.createElement("img");
                    imgNode.setAttribute('src', data.url)
                    $(this).summernote('insertNode', imgNode);
                  })
                }
              }
            });
        });
                   var sendFile = function(file, callback) {
                    var data;
                    data = new FormData();
                    data.append("file", file);
                    return $.ajax({
                      url: "/addImgSummer",
                      data: data,
                      cache: false,
                      contentType: false,
                      processData: false,
                      type: 'POST',
                      success: function(data) {
                        return callback(data);
                      }
                    });
                  };
</style>
Comment

flask get summernote text

@app.route("/addImgSummer", methods=["POST"])
def addImgSummer():
    #Grabbing file:
    img = request.files["file"]    #<------ THIS LINE RIGHT HERE! Is #literally all I needed lol.

    # Below is me replacing the img "src" with my S3 bucket link attached, with the said filename that was added. 
    imgURL = "https://"+ S3_BUCKET_NAME +".s3.amazonaws.com/images/"+ img.filename

    return jsonify(url = imgURL)
Comment

PREVIOUS NEXT
Code Example
Python :: form a chakravyuh matrix python 
Python :: python forward and bachward seperators 
Python :: python load array 
Python :: iversao de matriz python 
Python :: shorthand python if 
Python :: jet 4 access python password 
Python :: python - concatenate if null 
Python :: first hitting time python 
Python :: duplicate finder python modules 
Python :: call for a last number in series python 
Python :: pyelastic search get document 
Python :: what takes more memory string or list python 
Python :: how to set time.sleep(2) on instapy 
Python :: extract label from tf data 
Python :: get attribute of timestamp python 
Python :: how to copy items in list n times in list python 
Python :: fibonacci series recursive python 
Python :: KivyMD video recording 
Python :: matplotlib FiveThirtyEight horizontal graph 
Python :: how to read xlsx file from one directory above python 
Python :: sql o que é 
Python :: remove punctuation and special charaacters nltk 
Python :: finda argument index 
Python :: append to a list without intializing 
Python :: python urllib.request.urlretrieve with a progressbar 
Python :: # swap variables 
Python :: how to use ci variables in python robot 
Python :: collecion.alt shopify python 
Python :: custom port odoo 
Python :: PHP echo multi lines Using Heredoc variable 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =