Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. $this->add([
  2. 'name' => 'DCL_Path',
  3. 'type' => 'File',
  4. //'required' => true,
  5. 'options' => [
  6. 'label' => 'path to file',
  7. ],
  8. ]);
  9.  
  10. $inputFilter->add([
  11. 'type' => 'ZendInputFilterFileInput',
  12. 'name' => 'DCL_Path', // Element's name.
  13. 'required' => true, // Whether the field is required.
  14. 'filters' => [ // Filters.
  15. [
  16. 'name' => ZendFilterFileRenameUpload::class,
  17. 'options' => [
  18. 'use_upload_extension' => true,
  19. 'randomize' => false,
  20. 'overwrite' => true,
  21. 'target' => 'public/files',
  22. ],
  23. ],
  24. ],
  25. 'validators' => [ // Validators.
  26. [
  27. 'name' => ZendValidatorFileExtension::class,
  28. 'options' => [
  29. 'extension' => 'xls, xlsx',
  30. 'message' => 'File extension not match',
  31. ],
  32. ],
  33. [
  34. 'name' => ZendValidatorFileMimeType::class,
  35. 'options' => [
  36. 'mimeType' => 'vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', //'text/xls', 'text/xlsx',
  37. 'message' => 'File type not match',
  38. ],
  39. ],
  40. [
  41. 'name' => ZendValidatorFileSize::class,
  42. 'options' => [
  43. 'min' => '1kB', // minimum of 1kB
  44. 'max' => '4MB',
  45. 'message' => 'File too large',
  46. ],
  47. ],
  48. ]
  49. ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement