I have a problem with uploading Images in a Zend Framework 2 Application and i think i have a configuration error somewhere in my code.
This is my current Code. I created the Form and Filter like the ZfcUser Form.
Form extends ProvidesEventsForm(ZfcBase)
$file = new Element\File('image');
$file->setLabelAttributes(array('class' => 'control-label col-sm-4'));
$file->setLabel('image');
$this->add($file);
Filter extends ProvidesEventsInputFilter(ZfcBase)
$this->add(
array(
'type' => 'Zend\InputFilter\FileInput',
'name' => 'image',
'required' => true,
'validators' => array(
array(
'name' => 'File\UploadFile',
),
),
'filters' => array(
array(
'name' => 'File\RenameUpload',
'options' => array(
'target' => './public/img/uploads',
'randomize' => true,
),
),
),
)
);
In the validation process the method FileInput::isValid() is called - but the Value is always null and i have no clue why it is.
The HTML-Form is set to multipart/form-data and the Server configuration is also no problem. The file i used for testing is only 80KB.
Anyone an idea, what is wrong?