Permalink
Browse files

MINOR: fixed docs

fixed AllowedExtensions docs
added AllowedMaxFileSize docs
  • Loading branch information...
1 parent 1c32cde commit 3a9edde8c472d955cac88dbee39d803143f23e19 @Zauberfisch Zauberfisch committed Oct 16, 2012
Showing with 15 additions and 1 deletion.
  1. +15 −1 docs/en/reference/uploadfield.md
View
16 docs/en/reference/uploadfield.md
@@ -90,9 +90,23 @@ the folder doesn't exist, it will be created.
## Limit the allowed filetypes
+`AllowedExtensions` is by default `File::$allowed_extensions` but can be overwritten for each UploadField:
+
:::php
- $uploadField->allowedExtensions = array('jpg', 'gif', 'png');
+ $uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
+
+
+## Limit the maximum file size
+`AllowedMaxFileSize` is by default set to the lower value of the 2 php.ini configurations: `upload_max_filesize` and `post_max_size`
+The value is set as bytes.
+
+NOTE: this only sets the configuration for your UploadField, this does NOT change your server upload settings, so if your server is set to only allow 1 MB and you set the UploadFIeld to 2 MB, uploads will not work.
+
+ :::php
+ $sizeMB = 2; // 2 MB
+ $size = $sizeMB * 1024 * 1024; // 2 MB in bytes
+ $this->getValidator()->setAllowedMaxFileSize($size);
## Other configuration settings

0 comments on commit 3a9edde

Please sign in to comment.