Skip to content

Instantly share code, notes, and snippets.

@sasezaki
Created January 9, 2013 12:06
Show Gist options
  • Select an option

  • Save sasezaki/4492643 to your computer and use it in GitHub Desktop.

Select an option

Save sasezaki/4492643 to your computer and use it in GitHub Desktop.
ZF2 InputFilter Upload's Filter decalation by scalar (not method calling)
<?php
// @see https://github.com/cgmartin/ZF2FileUploadExamples/blob/master/src/ZF2FileUploadExamples/Form/SingleUpload.php
$inputFilter = new InputFilter\InputFilter();
$file = array(
'type' => 'Zend\InputFilter\FileInput',
'name' => 'file',
'required' => FALSE,
'filters' => array(
array(
'name' => 'filerenameupload',
'options' => [
'target' => './data/tmpuploads/',
'overwrite' => true,
'use_upload_name' => false,
'randomize' => true]
)
)
);
$inputFilter->add($file);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment