In my custom module I'm trying to upload an image via my save controller, I added the form in my block with this code:
protected function _prepareForm()
{
$model = $this->_coreRegistry->registry('homepagecontent_blocks');
$form = $this->_formFactory->create();
$form->setHtmlIdPrefix('content_');
$form->setFieldNameSuffix('content');
$fieldset = $form->addFieldset(
'base_fieldset',
['legend' => __('General')]
);
$fieldset->addField(
'image',
'image',
array(
'name' => 'image',
'label' => __('Image'),
'title' => __('Image')
)
);
When I var_dump my $_POST value, this is displayed:
array (size=3)
'form_key' => string 'ri7aWhZX3L56e10f' (length=16)
'content' =>
array (size=7)
'css_grid_column_from' => string '1' (length=1)
'css_grid_column_to' => string '2' (length=1)
'css_grid_row_from' => string '4' (length=1)
'css_grid_row_to' => string '1' (length=1)
'status' => string '1' (length=1)
'link' => string 'asfasf' (length=6)
'text' => string 'hdghgf' (length=6)
'image' => string 'imagename.jpeg' (length=15)
However my $_FILES variable is empty. Any idea what's wrong?