Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/06-concepts/02-endpoints-and-apis/07-file-uploads.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,19 @@ pod.addCloudStorage(
);
```

To connect a storage you created in your Serverpod Cloud project under another id, use `custom` with that id. This needs `serverpod_cloud_storage` 4.0.2 or later:

```dart
pod.addCloudStorage(
await ServerpodCloudProvider.custom(
storageId: 'exports',
fallback: () => DatabaseCloudStorage('exports'),
),
);
```

If the storage does not exist in your Cloud project, the server throws a `CloudStorageException` at startup. To create one, use the [storage commands](/cloud/reference/cli/commands/storage) in the Cloud CLI.

When Serverpod Cloud provides storage for your project, these calls connect to it. Otherwise, for example when you run the server locally, the `fallback` runs and files are stored in the database. To keep files somewhere else, replace these calls with one of the storages below.

Pick the package that matches your provider. Use [serverpod_cloud_storage_s3](https://pub.dev/packages/serverpod_cloud_storage_s3) for AWS S3, [serverpod_cloud_storage_gcp](https://pub.dev/packages/serverpod_cloud_storage_gcp) for Google Cloud Storage, or [serverpod_cloud_storage_r2](https://pub.dev/packages/serverpod_cloud_storage_r2) for Cloudflare R2.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,19 @@ pod.addCloudStorage(
);
```

To connect a storage you created in your Serverpod Cloud project under another id, use `custom` with that id. This needs `serverpod_cloud_storage` 4.0.2 or later:

```dart
pod.addCloudStorage(
await ServerpodCloudProvider.custom(
storageId: 'exports',
fallback: () => DatabaseCloudStorage('exports'),
),
);
```

If the storage does not exist in your Cloud project, the server throws a `CloudStorageException` at startup. To create one, use the [storage commands](/cloud/reference/cli/commands/storage) in the Cloud CLI.

When Serverpod Cloud provides storage for your project, these calls connect to it. Otherwise, for example when you run the server locally, the `fallback` runs and files are stored in the database. To keep files somewhere else, replace these calls with one of the storages below.

Pick the package that matches your provider. Use [serverpod_cloud_storage_s3](https://pub.dev/packages/serverpod_cloud_storage_s3) for AWS S3, [serverpod_cloud_storage_gcp](https://pub.dev/packages/serverpod_cloud_storage_gcp) for Google Cloud Storage, or [serverpod_cloud_storage_r2](https://pub.dev/packages/serverpod_cloud_storage_r2) for Cloudflare R2.
Expand Down
Loading