Daniel Schmidt
Daniel Schmidt

Reputation: 11931

File upload at google apps script

I would like to add a fileupload to my Google Apps Script App. In my Server Handler I just call my function like this:

    function serverHandler(params){
      uploadFile(params);
    ....

and the function looks like this:

    function uploadFile(e){ 
      var fileBlob = e.parameter.upload;
      var adoc = DocsList.createFile(fileBlob);
      return adoc.getUrl();
    }

I always get the error: "Error encountered: Method createFile( not found and i have no clue how to solve it. Thanks for your help!

Upvotes: -1

Views: 2067

Answers (1)

Srik
Srik

Reputation: 7965

You cannot upload a file using a server handler. You should necessarily be doing a POST from a form Submit button.

See the nice example code in the FileUpload widget documentation

Upvotes: 2

Related Questions