I'm struggling to understand and implement the instructions provided at https://developers.google.com/drive/v3/web/manage-uploads#save-session-uri
While I've successfully used javascript to upload files to Google Drive, I am now faced with a challenge of uploading large files (>1GB) which causes my current scripts to crash the browser. To address this issue, I have opted for the resumable upload option. After sending the Resumable session initiation request, I received a 200 OK header with Location header URI.
The tutorial suggests, "Copy and save the session URI so you can use it for subsequent requests." I am having trouble figuring out how to achieve this in javascript. How can I save a URI from a header? Is there a better approach to handling this task? Although I am more comfortable with Python (and have managed to get resume-able uploads working), unfortunately, we need to accomplish this in javascript. Below is an excerpt of my code (with sensitive information removed):
// Your Client ID can be retrieved from your project in the Google
// Developer Console, https://console.developers.google.com
var CLIENT_ID = '<YOURCLIENTID>';
var SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly', 'https://www.googleapis.com/auth/drive.file'];
/**
* Check if current user has authorized this application.
*/
function checkAuth() {
gapi.auth.authorize(
{
'client_id': CLIENT_ID,
'scope': SCOPES.join(' '),
'immediate': true
}, handleAuthResult);
}
// Other functions and handlers as per the original code example...