Skip to content

Add custom file size limit and mime types at bucket level #7

@tehnorm

Description

@tehnorm

Feature request

Ability to specify file_size_limit and allowed_mime_types when creating a bucket. This will help bring the library up to LW7 feature parity.

Describe the solution you'd like

Borrowing from the

$storage = new Storage\StorageClient($url, [
        Authorization' => 'Bearer ' . $service_key,
]);

// Create Bucket with file size limit 20mb
$opts = [
        'public' => true,
        'fileSizeLimit' => '20mb',
        'allowedMimeTypes' => ['image/jpeg'],
];
$result = $storage->createBucket('my-new-storage-bucket', $opts);

$bigFile = ... // 1GB

try {
        $result = $storage->upload($file_path, $bigFile);
} catch ($e) {
        expect($e).toEqual({
                error: 'Payload too large',
                message: 'The object exceeded the maximum allowed size',
                statusCode: '413',
        });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions