Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $this->add([
- 'name' => 'DCL_Path',
- 'type' => 'File',
- //'required' => true,
- 'options' => [
- 'label' => 'path to file',
- ],
- ]);
- $inputFilter->add([
- 'type' => 'ZendInputFilterFileInput',
- 'name' => 'DCL_Path', // Element's name.
- 'required' => true, // Whether the field is required.
- 'filters' => [ // Filters.
- [
- 'name' => ZendFilterFileRenameUpload::class,
- 'options' => [
- 'use_upload_extension' => true,
- 'randomize' => false,
- 'overwrite' => true,
- 'target' => 'public/files',
- ],
- ],
- ],
- 'validators' => [ // Validators.
- [
- 'name' => ZendValidatorFileExtension::class,
- 'options' => [
- 'extension' => 'xls, xlsx',
- 'message' => 'File extension not match',
- ],
- ],
- [
- 'name' => ZendValidatorFileMimeType::class,
- 'options' => [
- 'mimeType' => 'vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', //'text/xls', 'text/xlsx',
- 'message' => 'File type not match',
- ],
- ],
- [
- 'name' => ZendValidatorFileSize::class,
- 'options' => [
- 'min' => '1kB', // minimum of 1kB
- 'max' => '4MB',
- 'message' => 'File too large',
- ],
- ],
- ]
- ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement