You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This rule will validate `$_FILES` data, but not for multiple uploaded files.
444
-
Field under this rule must be following rules below to be valid:
443
+
This rule will validate data from `$_FILES`.
444
+
Field under this rule must be follows rules below to be valid:
445
445
446
446
*`$_FILES['key']['error']` must be `UPLOAD_ERR_OK` or `UPLOAD_ERR_NO_FILE`. For `UPLOAD_ERR_NO_FILE` you can validate it with `required` rule.
447
447
* If min size is given, uploaded file size **MUST NOT** be lower than min size.
@@ -455,6 +455,56 @@ Here are some example definitions and explanations:
455
455
*`uploaded_file:0,1M`: uploaded file size must be between 0 - 1 MB, but uploaded file is optional.
456
456
*`required|uploaded_file:0,1M,png,jpeg`: uploaded file size must be between 0 - 1MB and mime types must be `image/jpeg` or `image/png`.
457
457
458
+
Optionally, if you want to have separate error message between size and type validation.
459
+
You can use `mimes` rule to validate file types, and `min`, `max`, or `between` to validate it's size.
460
+
461
+
For multiple file upload, PHP will give you undesirable array `$_FILES` structure ([here](http://php.net/manual/en/features.file-upload.multiple.php#53240) is the topic). So we make `uploaded_file` rule to automatically resolve your `$_FILES` value to be well-organized array structure. That means, you cannot only use `min`, `max`, `between`, or `mimes` rules to validate multiple file upload. You should put `uploaded_file` just to resolve it's value and make sure that value is correct uploaded file value.
0 commit comments