:orphan:
# PetscGoogleDriveUpload
Loads a file to the Google Drive 
## Synopsis
```
PetscErrorCode PetscGoogleDriveUpload(MPI_Comm comm, const char access_token[], const char filename[])
```
Not Collective, only the first process in the `MPI_Comm` uploads the file


## Input Parameters

- ***comm -*** MPI communicator
- ***access_token -*** obtained with PetscGoogleDriveRefresh(), pass `NULL` to have PETSc generate one
- ***filename -*** file to upload; if you upload multiple times it will have different names each time on Google Drive



## Options Database Key

- ***-google_refresh_token XXX -*** pass the access token for the operation



## Usage Patterns
```none
    With PETSc option -google_refresh_token  XXX given
    PetscGoogleDriveUpload(comm,NULL,filename);        will upload file with no user interaction

    Without PETSc option -google_refresh_token XXX given
    PetscGoogleDriveUpload(comm,NULL,filename);        for first use will prompt user to authorize access to Google Drive with their browser

    With PETSc option -google_refresh_token  XXX given
    PetscGoogleDriveRefresh(comm,NULL,access_token,sizeof(access_token));
    PetscGoogleDriveUpload(comm,access_token,filename);

    With refresh token entered in some way by the user
    PetscGoogleDriveRefresh(comm,refresh_token,access_token,sizeof(access_token));
    PetscGoogleDriveUpload(comm,access_token,filename);

    PetscGoogleDriveAuthorize(comm,access_token,refresh_token,sizeof(access_token));
    PetscGoogleDriveUpload(comm,access_token,filename);
```





## See Also
 `PetscURLShorten()`, `PetscGoogleDriveAuthorize()`, `PetscGoogleDriveRefresh()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/webclient/google.c.html#PetscGoogleDriveUpload">src/sys/webclient/google.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/webclient/tutorials/googledriveupload.c.html">src/sys/webclient/tutorials/googledriveupload.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/webclient/google.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
