Six built-in cloud sources. AjaxUploader ships first-class pickers for Google Drive, OneDrive, Dropbox, Box, Unsplash, and the Companion broker - browser OAuth implicit flow for the direct pickers, or server-side OAuth via the Companion broker when the browser should never see a token. Drive and Box download authorized files into the browser before uploading. Public file URLs use the server-side import endpoint. Extend further via AjaxUploader.registerRemoteSource(name, source) for any custom file portal (SharePoint, Egnyte, internal DMS).
What you should see: select a file in Google Drive, then start its upload from the queue.
Setup required. The Google Drive button below renders disabled until you configure an API key + OAuth client ID:
- Create a project at
console.cloud.google.com, enable the Picker API. - Create an API key (Credentials -> API key).
- Create an OAuth 2.0 Client ID (Credentials -> Create -> OAuth client ID -> Web application). Add your origin to "Authorized JavaScript origins".
- Configure the adapter before
create():
AjaxUploader.configureRemoteSource('googledrive', {
apiKey: 'YOUR_API_KEY',
clientId: 'YOUR_OAUTH_CLIENT_ID'
});
Registering a custom source
AjaxUploader.registerRemoteSource('dropbox', {
title: 'Dropbox',
icon: '<svg viewBox=...>...</svg>', // SVG markup or img URL ready: function () { return !!window.Dropbox; },
pick: function (uploader) {
return new Promise(function (resolve, reject) {
window.Dropbox.choose({
multiselect: true,
linkType: 'direct',
success: function (files) {
resolve(files.map(function (f) {
return { url: f.link, fileName: f.name, fileSize: f.bytes };
}));
},
cancel: function () { reject(new Error('cancelled')); }
});
});
}
});
AjaxUploader.create('#uploader', {
remoteSources: ['googledrive', 'dropbox']
});
RemoteFile shape returned from pick()
{
url: 'https://www.googleapis.com/drive/v3/files/abc?alt=media',
fileName: 'quarterly-report.pdf',
fileSize: 2_457_600, // optional contentType: 'application/pdf', // optional headers: { 'Authorization': 'Bearer ya29...' } // optional
}
Wire flow
- User clicks the source button rendered in the uploader chrome.
- Adapter's
pick() runs - typically opens an OAuth popup + provider's native file picker. - On select -> resolves with a
RemoteFile (or array). - For Drive and Box, the browser downloads the selected file using its provider token and adds the file to the queue.
- For public file URLs, the server fetches the content through
/import-url.
Built-in: Google Drive (no server broker needed)
Google Identity Services supplies an access token to Google Picker. The browser uses the token to download the selected file from Drive and sends the file to your uploader.
Also available
- Companion broker - a self-hosted Node OAuth broker for Dropbox, Box, Drive, and OneDrive. Tokens stay server-side and never reach the browser; supports proxy and server-to-destination modes.
- Unsplash source - search and import royalty-free imagery directly into the queue.
- Per-source MIME / size filters at picker-time via
options.