Skip to content

Expose the maxFileSize on createDirectFileUploadDescription in Sessions #3067

Closed as duplicate

Description

@vanlooverenkoen

Is your feature request related to a problem? Please describe.
CloudStorage has support to configure the maxFileSize but in the session it is not possible to configure that

Describe the solution you'd like
expose maxFileSize

Activity

  1. added
    area: storage
    on Jan 2, 2025
  2. SandPod commented on Jan 2, 2025

    @SandPod
    Contributor

    I agree that this should be exposed.

  3. Isakdl commented on Jan 14, 2025

    @Isakdl
    Collaborator

    Additional note: All params should be exposed, the expiration date is also missing from the createDirectFileUploadDescription.

  4. realmeylisdev commented on Jun 11, 2026

    @realmeylisdev
    Contributor

    @marcelomendoncasoares This appears to have been implemented and can likely be closed as completed.

    PR #4771 (feat: Cloud storage improvements, merged 2026-03-03) exposed these parameters on StorageAccess.createDirectFileUploadDescription, and the change first shipped in 3.4.0.

    On current main, session.storage.createDirectFileUploadDescription accepts:

    • expirationDuration (default Duration(minutes: 10))
    • maxFileSize (default 10 MiB)
    • contentLength
    • preventOverwrite

    Future<String?> createDirectFileUploadDescription({
    required String storageId,
    required String path,
    Duration expirationDuration = const Duration(minutes: 10),
    int maxFileSize = 10 * 1024 * 1024,
    int? contentLength,
    bool preventOverwrite = false,
    }) async {
    var storage = _session.server.serverpod.storage[storageId];
    if (storage == null) {
    throw CloudStorageException('Storage $storageId is not registered');
    }
    final hasOptions = contentLength != null || preventOverwrite;
    if (hasOptions && storage is CloudStorageWithOptions) {
    return await storage.createDirectFileUploadDescriptionWithOptions(
    session: _session,
    path: path,
    expirationDuration: expirationDuration,
    maxFileSize: maxFileSize,
    options: CloudStorageOptions(
    contentLength: contentLength,
    preventOverwrite: preventOverwrite,
    ),
    );
    } else {
    return await storage.createDirectFileUploadDescription(
    session: _session,
    path: path,
    expirationDuration: expirationDuration,
    maxFileSize: maxFileSize,
    );
    }
    }

    This covers both the original request (maxFileSize) and the expiration parameter mentioned in the comments — verified in the code on main.

    The duplicate issue #4733 (same request: expose max file size and expiration on session.storage.createDirectFileUploadDescription()) was closed as completed when PR #4771 merged, but this issue wasn't linked in that PR, so it stayed open.

  5. moved this from Backlog 🗂️ to Done 🚀 in Serverpod Frameworkson Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: storage

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions