Skip to content

Commit 475ae23

Browse files
committed
MAGETWO-90241: Image Uploader maxFileSize configuration can exceed PHP's upload_max_filesize
Use the minimum of the two configurations if both are present
1 parent 81b10b7 commit 475ae23

File tree

1 file changed

+4
-1
lines changed
  • app/code/Magento/Ui/Component/Form/Element/DataType/Media

1 file changed

+4
-1
lines changed

app/code/Magento/Ui/Component/Form/Element/DataType/Media/Image.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ public function getComponentName()
6464
public function prepare()
6565
{
6666
// dynamically set max file size based on php ini config if not present in XML
67-
$maxFileSize = $this->getConfiguration()['maxFileSize'] ?? $this->fileSize->getMaxFileSize();
67+
$maxFileSize = min(array_filter([
68+
$this->getConfiguration()['maxFileSize'] ?? null,
69+
$this->fileSize->getMaxFileSize()
70+
]));
6871

6972
$data = array_replace_recursive(
7073
$this->getData(),

0 commit comments

Comments
 (0)