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

[10.x] Support human-friendly text for file size #47846

Merged
merged 6 commits into from Jul 26, 2023
Merged

[10.x] Support human-friendly text for file size #47846

merged 6 commits into from Jul 26, 2023

Conversation

jxxe
Copy link
Contributor

@jxxe jxxe commented Jul 26, 2023

Allows declaring file size limits as 10mb instead of 10000 when validating file sizes.

$data = $request->validate([
    // ...
    'image' => 'required|image|max:10mb'
]);

I can never remember which unit file size limits are in, and since I'm often working in megabytes, the number of zeroes makes it hard to comprehend at a glance.

This converts numbers suffixed with kb, mb, gb, or tb (why not) into a number of kilobytes. Numbers without units work just as before.

@jxxe
Copy link
Contributor Author

jxxe commented Jul 26, 2023

Actually, since I changed some arguments names (though not their order), this is a breaking change if people use named arguments. Should I change this to merge to 11.x?

@taylorotwell taylorotwell merged commit a56efdb into laravel:10.x Jul 26, 2023
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants