Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

102
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda