Skip to main content

I am trying to upload slide image in Magento 2. In some form I have suffix in name attribute for image field like this:

<input id="slide_image" name="slide[image]" class="input-file">

My question is how can request this file in following way as I am trying to request file like this:

$this->getRequest()->getFiles('image');

I have also tried these ways with no luck

$this->getRequest()->getFiles('slide[image]');
$this->getRequest()->getFiles('slide.image');

thanks in advanced

I am trying to upload slide image in Magento 2. In some form I have suffix in name attribute for image field like this:

<input id="slide_image" name="slide[image]" class="input-file">

My question is how can request this file in following way as I am trying to request file like this:

$this->getRequest()->getFiles('image');

I have also tried these ways with no luck

$this->getRequest()->getFiles('slide[image]');
$this->getRequest()->getFiles('slide.image');

thanks in advanced

I am trying to upload slide image in Magento 2. In some form I have suffix in name attribute for image field like this:

<input id="slide_image" name="slide[image]" class="input-file">

My question is how can request this file in following way as I am trying to request file like this:

$this->getRequest()->getFiles('image');

I have also tried these ways with no luck

$this->getRequest()->getFiles('slide[image]');
$this->getRequest()->getFiles('slide.image');
Source Link

Magento 2 - How to request file with field name suffix

I am trying to upload slide image in Magento 2. In some form I have suffix in name attribute for image field like this:

<input id="slide_image" name="slide[image]" class="input-file">

My question is how can request this file in following way as I am trying to request file like this:

$this->getRequest()->getFiles('image');

I have also tried these ways with no luck

$this->getRequest()->getFiles('slide[image]');
$this->getRequest()->getFiles('slide.image');

thanks in advanced