How can a file be retrieved from a users drive with Google Apps Script? I've tried:
var fetchURL = 'file:///C://Users//Gigabyte//Pictures//file_name.JPG';
var image = UrlFetchApp.fetch(fetchURL).getBlob();
I've tried using escape characters instead of slashes.
'file:%2F%2F%2FC:%2FUsers%2FGigabyte%2FPictures%2Ffile_name.JPG'
I've tried different variations of back and forward slashes. No luck so far.
Or maybe I'm going about this in the wrong way. Maybe I need to get the file blob some other way?
I did find information on how to get a file from the users drive, into the the website: Stackoverflow Understanding
But Caja does seem to strip out or block a new blob being defined.
I found this code at this site: HTML5 Rocks
// Check for the various File API support.
if (window.File && window.FileReader && window.FileList && window.Blob) {
alert('Great success! All the File APIs are supported.');
} else {
alert('The File APIs are not fully supported in this browser.');
}
When I run that code from Notepad++ in Chrome, it checks out fine. When I run that code inside Google Apps Script in Chrome, something goes wrong. So, . . . obviously there is a way to upload files. It happens all the time. But I can't do it through the HTML service in Google Apps Script. I can trigger a Google Apps Script UI, that will upload a file from the users computer to my Google drive. And I guess that is my only option. I don't know of a way to embed a UI inside of HTML page.