I have a custom HTML page from which I can select a file and upload. The app script gets the file and uploads it to Drive. But when I do this all the images are uploaded in an unsupported format. I download the file from the drive app and when I open it on the windows desktop, it says unsupported format.
Can someone help here, please
HTML file
<input type="file" id="cImg" name="cImg"/>
<input type="submit" value="Submit" class="btn btn-primary" id="btnSave" />
Java script
form.addEventListener('submit', e => {
e.preventDefault();
if(form.checkValidity()) {
google.script.run.withSuccessHandler(FormReset).SaveComplaint(form);
}
else {
form.reportValidity();
}
})
App Script
function SaveComplaint(form)
{
var fileBlob = form.cImg;
var folder = DriveApp.getFolderById('XXXXXXXX'); // Drive Folder ID
var upFile = folder.createFile(fileBlob);
}