Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

Commit

Permalink
upload widget fix
Browse files Browse the repository at this point in the history
security component wasn't having it
  • Loading branch information
highstrike committed Sep 28, 2016
1 parent 7da6699 commit 725d6ed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/View/Widget/UploadWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Cake\View\Widget\WidgetInterface;
use Cake\View\Form\ContextInterface;
use Cake\View\View;
use Cake\Core\Exception\Exception;

/**
* Upload
Expand All @@ -15,7 +16,7 @@
* read the configuration in the uploadable behaviour
*
* @author Flavius
* @version 0.1
* @version 0.2
*/
class UploadWidget implements WidgetInterface
{
Expand Down Expand Up @@ -70,9 +71,12 @@ public function render(array $data, ContextInterface $context) {
* {@inheritDoc}
*/
public function secureFields(array $data) {
if(!isset($data['suffix']))
throw new Exception("You forgot to add the suffix to the form field '{$data['name']}'");

$fields = [];
foreach(['name', 'type', 'tmp_name', 'error', 'size'] as $suffix)
$fields[] = $data['name'] . '[' . $suffix . ']';
$fields[] = $data['name'] . $data['suffix'] . '[' . $suffix . ']';

return $fields;
}
Expand Down

0 comments on commit 725d6ed

Please sign in to comment.