diff --git a/docs/en/core-libraries/validation.md b/docs/en/core-libraries/validation.md index 2a7e343016..b052284383 100644 --- a/docs/en/core-libraries/validation.md +++ b/docs/en/core-libraries/validation.md @@ -675,6 +675,21 @@ Core rules that take additional parameters should have an array for the `rule` key that contains the rule as the first element, and the additional parameters as the remaining parameters. +### File Extensions + +`Validation::extension()` accepts `gif`, `jpeg`, `png`, `jpg`, `jxl`, `webp`, +`avif` and `avifs` by default. Supply an explicit list to restrict extensions +for a particular upload: + +```php +$validator->add('photo', 'extension', [ + 'rule' => ['extension', ['jpg', 'jpeg', 'png']], +]); +``` + +The rule checks the filename extension, not the file's contents. Use a MIME +type rule as well when you need to check the uploaded content. + ### IP and Range Validation You can validate that a value is a valid IP address or an IP range (subnet) diff --git a/docs/en/views/helpers/form.md b/docs/en/views/helpers/form.md index bb04a8c5c9..3ccf8481fd 100644 --- a/docs/en/views/helpers/form.md +++ b/docs/en/views/helpers/form.md @@ -2020,7 +2020,8 @@ You could then use JavaScript to set the `onvalid` and `oninvalid` events as you Creates an `input` element of `submit` type, with `$caption` as value. If the supplied `$caption` is a URL pointing to an image (i.e. if the string -contains '://' or contains any of the extensions '.jpg, .jpe, .jpeg, .gif'), +contains '://' or ends in `.jpg`, `.jpe`, `.jpeg`, `.jxl`, `.gif`, `.png`, +`.webp`, `.ico`, `.avif` or `.avifs`), an image submit button will be generated, using the specified image if it exists. If the first character is '/' then the image path is relative to *webroot*, else if the first character is not '/' then the image path is