Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tehnorm opened this issue Apr 12, 2023 · 0 comments
Open

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

tehnorm opened this issue Apr 12, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@tehnorm
Copy link
Contributor

tehnorm commented Apr 12, 2023

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',
        });
}
@tehnorm tehnorm added the enhancement New feature or request label Apr 12, 2023
@tehnorm tehnorm changed the title Custom file size limit and mime types at bucket level Add custom file size limit and mime types at bucket level Apr 12, 2023
tehnorm added a commit that referenced this issue Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant