I have a custom module which manage to upload the banners.
Everything working fine except image validation.
Below is my code for the image in
app/code/E25media/Bannersmanager/Block/Adminhtml/Banners/Edit/Tab/Main.php
<?php
namespace E25media\Bannermanager\Block\Adminhtml\Banners\Edit\Tab;
class Main extends \Magento\Backend\Block\Widget\Form\Generic implements \Magento\Backend\Block\Widget\Tab\TabInterface
{
/* -- some code here */
protected function _prepareForm()
{
/* -- some code here */
$fieldset->addType('image', '\E25media\Bannermanager\Block\Adminhtml\Banners\Helper\Image');
$fieldset->addField('banner_image_mobile', 'image', array(
'name' => 'banner_image_mobile',
'class' => 'required-entry required-file',
'label' => __('Mobile Banner Image'),
'title' => __('Mobile Banner Image'),
'required' => true,
'disabled' => $isElementDisabled));
/* -- some code here */
}
My form file upload is look like this.
But i can submit the form without uploading the image.
How to validate the image file ?