Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
How do I insert the doPost function into my web code

I need to let the image created by web auto save and post to google drive's folder by using doPost(e). I already deploy this web on google app script,but I don't know how to insert the 'post' function in my html code.

Here is image created and save part of my html code.

<script src="./plugin/canvas-sign.js"></script>
<script>
    /*
        let width = Dimensions.get("screen").width;
        let height = Dimensions.get("screen").height;
        */
    /*
    var screenwidth = (window.innerWidth > 0) ? window.innerWidth : screen.width;
    var screenheight = (window.innerHeight > 0) ? window.innerHeight : screen.height;
    */

    let cv = document.getElementById("canvas");
    let rect = document.getElementById("app").getBoundingClientRect();
    cv.width = screenwidth;
    // console.log(app.getBoundingClientRect());
    cv.height = screenheight;
    //rect.height
    let canvas = new canvasSign(cv);
    let dataJson;
    canvas.on('drawend', (e) => {
        dataJson = canvas.toJson().dataJson;
    })
    function upload() {
        let img = document.createElement("a");
        img.href = canvas.getPNGImage();
        img.download = "canvas-sign.png";
        img.style.display = "none";
        document.body.appendChild(img);
        img.click();
        const formData = new FormData(canvas.getPNGImage());
        //formData.append(img, img, "canvas-sign.png");
        document.body.removeChild(img);
    }

    function colorChange(e) {
        let value = e.target.options[e.target.selectedIndex].value
        canvas.setLineStyle({
            strokeStyle: value,
            shadowColor: value
        })
    }

</script>

Here is Google app script's code

function doPost(e){

  //var postName = e.parameter.name;
  var postImg = e.parameter.img;

  var folder = DriveApp.getFolderById("1yECMj1EvBQhV1gigslYJu5KM3bxsK9yy");

  var copyImg = postImg.makeCopy("簽名檔", folder);


}

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!