Just wondering why I can't get value of array name from input type file.
HTML:
<input type="file" name="collateral_photo[]" id="collateral_photo" class="default"/>
The name of this input file is an array.
PHP Laravel
return Request::file('collateral_photo');
The return result is [{}]
What I want right now just how to get value from this input file with array name.
Please, please help me out.
Thank you very much for any help.
use the below code, since the name attribute is an array
$files = Request::file('collateral_photo');
return $files[0];
or if you want second file
return $files[1];
//if you want to access second file and so on
you need to access the file with array index specified.
If you want to return the whole files array itself then use
return $files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With