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.

 Methods

__invoke()

__invoke(\Zend\Form\FormInterface $form, string $redirect, bool $redirectToUrl) : bool | array | \Zend\Http\Response

Parameters

$redirect

string

Route or URL string (default: current route)

$redirectToUrl

bool

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

Returns

Get the current controller instance

getController() : null | \Zend\Stdlib\DispatchableInterface
Inherited

inherited_from \Zend\Mvc\Controller\Plugin\AbstractPlugin::getController()

Returns

getSessionContainer()

getSessionContainer() : \Zend\Session\Container

Set the current controller instance

setController(\Zend\Stdlib\DispatchableInterface $controller) : void
Inherited

inherited_from \Zend\Mvc\Controller\Plugin\AbstractPlugin::setController()

Parameters

setSessionContainer()

setSessionContainer(\Zend\Session\Container $container) : \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

$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

$data

array

Returns

array

handleGetRequest()

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

Parameters

Returns

boolarray

handlePostRequest()

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

Parameters

$redirect

string

Route or URL string (default: current route)

$redirectToUrl

bool

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

Returns

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

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

Parameters

$redirect

string

$redirectToUrl

bool

Exceptions

\Zend\Mvc\Exception\RuntimeException

Returns

setProtectedFormProperty()

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

Parameters

$property

string

$value

mixed

Returns

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

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

Parameters

$values

array

$callback

\Zend\Mvc\Controller\Plugin\callable

Returns

arraynull

 Properties

 

$controller

$controller : null | \Zend\Stdlib\DispatchableInterface
Inherited

inherited_from \Zend\Mvc\Controller\Plugin\AbstractPlugin::$$controller
 

$sessionContainer

$sessionContainer : \Zend\Session\Container