Google Cloud Storage

Filestack can also be configured to store files directly into your Google Cloud Storage (GCS) account. This storage option requires a custom plan.

To begin configuring storage to your GCS account you will need admin access to GCS and to your Filestack Developer Portal

Google Cloud Storage

To start storing your uploads to GCS:

1. go to https://cloud.google.com/storage, sign up for an account or login to an existing one. Create and name a new project

2. Navigate the menu to select Storage > Browser page as shown here:

Screenshot showing navigation to GCS storage

3. Click Create Bucket

Screenshot showing GCS bucket creation

4. Name your bucket and select your storage class.

Most users will want to choose Multi-Regional or Regional for fastest access to your assets.

Screenshot showing GCS bucket configuration for Filestack

5. Navigate back to the Google Cloud Platform Home Dashboard.

6. Find APIs & Services and select Credentials.

Screenshot showing navigation to GCS credentials

7. Select the dropdown to create credentials. Select Service account key

Screenshot showing navigation to GCS credential type

8. Use the dropdown to create a new service account.

Name your account and choose Project > Owner as the role type. Key type should be set to JSON

Screenshot showing GCS Service account key creation

9. After you click Create, the JSON file will be downloaded to your default download location on your computer.

Save this in a secure location.

10. Go to your Filestack Developer Portal and find Google Cloud Storage under the Storage section.

Copy the ENTIRE JSON from the file you saved earlier and paste it into the Access Key input.

The Default Container is the name of the bucket you set up in step 4. The project name is the one you set up in step 1.

Click Test Google Cloud Settings.

Screenshot showing entry of GCS credentials into Filestack Developer Portal

Google Cloud Storage is now added to your Filestack account!

Storing to GCS using the Javascript API

You can send files to your Google Cloud Storage with the client.pick Javascript API method.

client.pick({
  storeTo: {
    location: 'gcs',
    path: '/myfiles/1234.png',
  }
}).then(result => {
  console.log(JSON.stringify(result.filesUploaded))
})

Dropbox Storage Options for Javascript API

storeTo Object

storeTo: { parameter: value }

Accepts an optional dictionary of key-value pairs that specify how the picker should store files once they are selected for upload.

Location String

storeTo: { location: 'gcs' }

Where to store the file. The default is s3. Other options are 'azure', 'dropbox', 'rackspace' and 'gcs'. You must have configured your storage in the developer portal to enable this feature.

Note: Azure, Dropbox and Google Cloud are only available on custom plans.

Path String

storeTo: { path: '/myfiles/1234.png' }

The path to store the file at within the specified file store. For S3, this is the key where the file will be stored at. By default, Filestack stores the file at the root at a unique id, followed by an underscore, followed by the filename, for example '3AB239102DB_myphoto.png'.

If the provided path ends in a '/', it will be treated as a folder, so if the provided path is 'myfiles/' and the uploaded file is named 'myphoto.png', the file will be stored at 'myfiles/909DFAC9CB12_myphoto.png', for example.

Important: If the maxFiles parameter is greater than one, be sure to only use paths that end in '/' or else all uploaded files will be written to the same object in your bucket. In other words, the files will overwrite each other.

Container String

storeTo: { container: 'user-photos' }

The bucket in the specified file store where the file should end up. This is especially useful if you have different containers for testing and production and you want to use them both on the same Filestack app. If this parameter is omitted, the file is stored in the default container specified in your developer portal.