type: docs order: 32 title: "Google Drive" module: "@uppy/google-drive"
The @uppy/google-drive
plugin lets users import files from their Google Drive account.
A Companion instance is required for the @uppy/google-drive
plugin to work. Companion handles authentication with Google, downloads files from the Drive and uploads them to the destination. This saves the user bandwidth, especially helpful if they are on a mobile connection.
const GoogleDrive = require('@uppy/google-drive')
uppy.use(GoogleDrive, {
// Options
})
This plugin is published as the @uppy/google-drive
package.
Install from NPM:
npm install @uppy/google-drive
In the CDN package, it is available on the Uppy
global object:
const GoogleDrive = Uppy.GoogleDrive
Dashboard plugin is recommended as a container to all Provider plugins, including Google Drive. If you are using Dashboard, it comes with all the nessesary styles for Dropbox as well.
⚠️ If you are feeling adventurous, and want to use Google Drive plugin separately, without Dashboard, make sure to include @uppy/provider-views/dist/style.css
(or style.min.css
) CSS file. This is experimental, not officialy supported and not recommended.
The @uppy/google-drive
plugin has the following configurable options:
uppy.use(GoogleDrive, {
target: Dashboard,
serverUrl: 'https://companion.uppy.io/',
})
id: 'GoogleDrive'
A unique identifier for this plugin. It defaults to 'GoogleDrive'
.
title: 'Google Drive'
Configures the title / name shown in the UI, for instance, on Dashboard tabs. It defaults to 'Google Drive'
.
target: null
DOM element, CSS selector, or plugin to mount the Google Drive provider into. This should normally be the the @uppy/dashboard
plugin.
serverUrl: null
URL to a Companion instance.
serverHeaders: {}
Custom headers that should be sent along to Companion on every request.
serverPattern: serverUrl
The valid and authorised URL(s) from which OAuth responses should be accepted.
This value can be a String
, a Regex
pattern, or an Array
of both.
This is useful when you have your Companion running on multiple hosts. Otherwise, the default value should be good enough.
locale: {}
Localize text that is shown to the user.
The default English strings are:
strings: {
// TODO
}