I'm trying to restrict the weight of the uploaded file in admin, I found the 'maxFileSize' in Magento documentation but it's not working :
$fieldset->addField(
'files',
'file',
[
'name' => 'file',
'label' => __('File'),
'title' => __('File'),
'maxFileSize' => 2097152,
'required' => false,
'note' => 'File size must be less than 2 Mb.'
]
);
Thanks !
Best Answer
I think I would use php.ini instead.
To ensure that file uploads work correctly, the post_max_size directive should be a little larger than the upload_max_filesize. For example, the following settings demonstrate how to set a file upload limit to 20 megabytes: