Skip to content

Instantly share code, notes, and snippets.

@Colmea
Created December 8, 2014 12:30
Show Gist options
  • Save Colmea/8a16bad018fcb34fda2d to your computer and use it in GitHub Desktop.
Save Colmea/8a16bad018fcb34fda2d to your computer and use it in GitHub Desktop.
if ($request->isPost())
{
$data = array_merge($request->getPost()->toArray(), $this->getRequest()->getFiles()->toArray());
$form->setData($data);
[...]
OUTPUT:
array (size=5)
'csrf' => string '7a897d7cb3beea4125f182bb03950ba8-553e3eef0dd031b33bd502f3ef7d2e80' (length=65)
'submit' => string 'Ajouter le fichier' (length=18)
'file' =>
array (size=5)
'name' => string 'man-silhouette.png' (length=18)
'type' => string 'image/png' (length=9)
'tmp_name' => string '/tmp/php6id1Ru' (length=14)
'error' => int 0
'size' => int 2497
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment