Plugin to help facilitate Post/Redirect/Get for file upload forms (http://en.wikipedia.org/wiki/Post/Redirect/Get)

Requires that the Form's File inputs contain a 'fileRenameUpload' filter with the target option set: 'target' => /valid/target/path'. This is so the files are moved to a new location between requests. If this filter is not added, the temporary upload files will disappear between requests.

package Default
inherited_from \Zend\Mvc\Controller\Plugin\AbstractPlugin

 Methods

__invoke()

__invoke(\Zend\Form\FormInterface $form, string $redirect = null, boolean $redirectToUrl = false) : boolean | array | \Zend\Http\Response

Parameters

$form

\Zend\Form\FormInterface

$redirect

string

Route or URL string (default: current route)

$redirectToUrl

boolean

Use $redirect as a URL string (default: false)

Returns

booleanarray\Zend\Http\Response

Get the current controller instance

getController() : null | \Zend\Stdlib\DispatchableInterface
Inherited
inherited_from \Zend\Mvc\Controller\Plugin\PluginInterface::getController()

Returns

null\Zend\Stdlib\DispatchableInterface

getSessionContainer()

getSessionContainer() : \Zend\Session\Container

Returns

\Zend\Session\Container

Set the current controller instance

setController(\Zend\Stdlib\DispatchableInterface $controller) : void
Inherited
inherited_from \Zend\Mvc\Controller\Plugin\PluginInterface::setController()

Parameters

$controller

\Zend\Stdlib\DispatchableInterface

setSessionContainer()

setSessionContainer(\Zend\Session\Container $container) : \Zend\Mvc\Controller\Plugin\FilePostRedirectGet

Parameters

$container

\Zend\Session\Container

Returns

\Zend\Mvc\Controller\Plugin\FilePostRedirectGet

Traverse the InputFilter and only return the data of FileInputs that are empty

getEmptyUploadData(\Zend\InputFilter\InputFilterInterface $inputFilter, array $data) : array

Parameters

$inputFilter

\Zend\InputFilter\InputFilterInterface

$data

array

Returns

array

Traverse the InputFilter and only return the data of FileInputs that have an upload

getNonEmptyUploadData(\Zend\InputFilter\InputFilterInterface $inputFilter, array $data) : array

Parameters

$inputFilter

\Zend\InputFilter\InputFilterInterface

$data

array

Returns

array

handleGetRequest()

handleGetRequest(\Zend\Form\FormInterface $form) : boolean | array

Parameters

$form

\Zend\Form\FormInterface

Returns

booleanarray

handlePostRequest()

handlePostRequest(\Zend\Form\FormInterface $form, string $redirect, boolean $redirectToUrl) : \Zend\Http\Response

Parameters

$form

\Zend\Form\FormInterface

$redirect

string

Route or URL string (default: current route)

$redirectToUrl

boolean

Use $redirect as a URL string (default: false)

Returns

\Zend\Http\Response

TODO: Good candidate for traits method in PHP 5.4 with PostRedirectGet plugin

redirect(string $redirect, boolean $redirectToUrl) : \Zend\Http\Response

Parameters

$redirect

string

$redirectToUrl

boolean

Exceptions

\Zend\Mvc\Exception\RuntimeException

Returns

\Zend\Http\Response

setProtectedFormProperty()

setProtectedFormProperty(\Zend\Form\FormInterface $form, string $property, mixed $value) : \Zend\Mvc\Controller\Plugin\FilePostRedirectGet

Parameters

$form

\Zend\Form\FormInterface

$property

string

$value

mixed

Returns

\Zend\Mvc\Controller\Plugin\FilePostRedirectGet

Traverse the InputFilter and run a callback against each Input and associated value

traverseInputs(\Zend\InputFilter\InputFilterInterface $inputFilter, array $values, callable $callback) : array | null

Parameters

$inputFilter

\Zend\InputFilter\InputFilterInterface

$values

array

$callback

callable

Returns

arraynull

 Properties

 

$controller

$controller : null | \Zend\Stdlib\DispatchableInterface

Default

 

$sessionContainer

$sessionContainer : \Zend\Session\Container

Default