Skip to content
This repository was archived by the owner on Jul 16, 2021. It is now read-only.
This repository was archived by the owner on Jul 16, 2021. It is now read-only.

Size File Validation only deals with Kilobytes #2658

Description

@JoshSalway

It would be great if Laravel File Size would allow you to specify file size and the metric (eg. megabyte|mb, gigabyte|gb etc).

So instead of just:

// Validate that an uploaded file is exactly 512 kilobytes...
'image' => 'file|size:512';

Could do:
// Validate that an uploaded file is less then 2 mb...
'image' => 'file|size:2,mb';
// Validate that an uploaded file is less then 2 gb...
'image' => 'file|size:2,gb';

https://laravel.com/docs/8.x/validation#rule-size
https://laravelexamples.com/example/agorakit/helpers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions