I am integrating file uploader in admin form. It's working fine. but it has default 2MB upload file size limit.

This is my uploader class

public function __construct(
    \Magento\MediaStorage\Model\File\UploaderFactory $fileUploaderFactory,
) {
    $this->_fileUploaderFactory = $fileUploaderFactory;

public function uploadFile($scope)
   try {
        $uploader = $this->_fileUploaderFactory->create(['fileId' => $scope]);

        if ($uploader->save($this->getBaseDir())) {
            return $uploader->getUploadedFileName();    

    } catch (Exception $e) {
        throw new \Exception('The file was not uploaded.', $code);
    return '';

How we increase file uploader limit?

  • Please check "upload_max_filesize" in phpInfo() May 13, 2017 at 13:06
  • yes, it is working. May 13, 2017 at 13:14

2 Answers 2


I think there is no Default setting in code:

Just update php.ini settings:

memory_limit = 32M
upload_max_filesize = 24M
post_max_size = 32M

Hope this will work!!

  • Just to add, my php.ini was found at /etc/php/7.2/apache2/php.ini which can be determined by adding a file containing this <?php phpinfo(); ?> to the root of the server and browsing to it. As a final note, run service apache2 reload to get the changes to take effect. Nov 6, 2019 at 15:13

I have a strange problem. We have our post_max_size set to 32M in our PHP ini. (php 7.2) But when I goto upload our logo in Content/Design/Config it says "Max limit 1kb"

Where is Magento getting that value?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.