hasFile() is giving false for array of file object in controller Laravel

In the front end I having a loop with input type file with name as img_logo[$key] (of the loop) like:

<input type="file" name="img_logo[$key]" class="dropzone" id="" data-index="" >

After submitting the form it goes in the controller, there hasFile() giving true for img_logo but giving false for internal arrays.

I am stuck here only why this is happening, where I am getting it wrong. Although you can see the array’s element is also a file object but hasFile() giving them false. Please guide me here I am having an array of files with key, value pair as mentioned below:

array:4 [▼

"img_logo" => array:2 [▼
1 => UploadedFile {#462 ▼
-test: false
-originalName: "Quotefancy-101003-3840x2160.jpg"
-mimeType: "image/jpeg"
-error: 0
#hashName: null
path: "/tmp"
filename: "phpGbtonF"
basename: "phpGbtonF"
pathname: "/tmp/phpGbtonF"
extension: ""
realPath: "/tmp/phpGbtonF"
aTime: 2020-04-29 17:59:37
mTime: 2020-04-29 17:59:37
cTime: 2020-04-29 17:59:37
inode: 1078432563
size: 754605
perms: 0100600
owner: 1155
group: 1157
type: "file"
writable: true
readable: true
executable: false
file: true
dir: false
link: false
}
3 => UploadedFile {#464 ▶}
]
]

from Newest questions tagged laravel-5 – Stack Overflow https://ift.tt/2yXDrac
via IFTTT

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.