I'm trying to upload a file to a specific google drive folder along with form data into a spreadsheet. The spreadsheet portion of this code works, but the file upload function does not. Any help on fixing this would be appreciated.
Code.gs
var submissionSSKey = 'SS ID';
function doGet(e) {
var template = HtmlService.createTemplateFromFile('Form.html');
template.action = ScriptApp.getService().getUrl();
return template.evaluate();
}
function doPost(e) {
var template = HtmlService.createTemplateFromFile('Thanks.html');
var LoanType = template.name = e.parameter.name;
var borrower = template.department = e.parameter.department;
var amount = template.message = e.parameter.message;
var emailed = template.email = e.parameter.email;
var comp = 'N/A'
var sheet = SpreadsheetApp.openById(submissionSSKey).getSheets()[0];
var lastRow = sheet.getLastRow();
var targetRange = sheet.getRange(lastRow+1, 1, 1, 5).setValues([[comp,LoanType,borrower,amount,emailed]]);
var fileBlob = e.paramater.thefile
var doc = DriveApp.getFolderById('folder ID');
doc.createFile(fileBlob)//.rename('New Name');
return template.evaluate();
}
Form.html
<html>
<head>
<title></title>
</head>
<body>
<form action="<?= action ?>" enctype="multipart/form-data" method="post">
<table border="0" cellpadding="1" cellspacing="0" style="width: 500px;">
<tbody>
<tr>
<td>
Name:</td>
<td>
<input name="name" type="text" /></td>
</tr>
<tr>
<td>
Department:</td>
<td>
<select name="department">
<option>Select Option</option>
<option>Cashier</option>
<option>Greeter</option>
<option>Runner</option>
<option>Line Control</option>
<option>IDB</option>
<option>Unknown</option>
</select></td>
</tr>
<tr>
<td>
Email:</td>
<td>
<input name="email" type="text" /></td>
</tr>
<tr>
<td>
Message:</td>
<td>
<textarea name="message" style="margin: 2px; height: 148px; width: 354px;"></textarea></td>
</tr>
<tr>
<td>
<p>
School Schedule (Image Files Only):</p>
</td>
<td>
<p>
<input type="file" id="thefile" name="thefile">
</p></td>
</tr>
<tr>
<td>
<input type="submit" value="Submit" /></td>
<td>
You will receive an email confirmation upon submission</td>
</tr>
</tbody>
</table>
</form></body>
</html>
Thanks.html
<html>
<body>
<h1>Thanks</h1>
<p>Thank you for your submission.</p>
Name: <?= name ?><br/>
Department: <?= department ?><br/>
Message: <?= message ?><br/>
Email: <?= email ?><br/>
</body>
</html>