Using Values Submitted from HTML Form using Google Apps Script
This is a sample script for using the values submitted from the HTML form using Google Apps Script and Javascript. In this case, the values include the files.
Issue
<form>
Text: <input type="text" name="sampleText1" /><br />
Single file: <input type="file" name="sampleFile1" /><br />
<input
type="submit"
name="button"
value="submit"
onclick="main(this.parentNode)"
/>
</form>
<script>
function main(e) {
google.script.run.sample(e);
}
</script>
This is a simple sample script for sending the values of form to Google Apps Script. In this case, texts and file are sent. When the button is clicked, main() is run. In this case, this.parentNode is sent to google.script.run.sample(this.parentNode). At that time, at Google Apps Script side, the text value can be correctly retrieved. But the file cannot be correctly sent. When the file is created as a file on Google Drive, the file is broken. I think that the reason of this issue might be due to character code.