private function fileInput($elemName, $formFilter)
{
$target = $_SERVER['DOCUMENT_ROOT'].'/media/ModuleTpl/';
if (!is_dir($target))
mkdir($target, 0777);
// File Input
$fileInput = new \Laminas\InputFilter\FileInput($elemName);
$fileInput->setRequired(true);
$fileInput->getFilterChain()->attachByName(
'filerenameupload',
[
'target' => $target.'/ModuleTpl', // File name prefix
'randomize' => true,
'use_upload_extension' => true,
]
);
$formFilter->add($fileInput);
}
|