Livewire File Upload Foreach

What seems to be the problem:
Unable to access File upload

Steps to Reproduce:

  • Put a foreach around the file upload

Are you using the latest version of Livewire:
Yes

Do you have any screenshots or code examples:
wire:model=“photos.{{$key}}”
This just returns the upload storage location local

Has anyone found a way around this?

Are you trying to have multiple file upload fields or are you trying to iterate through your already uploaded files?

It’d be helpful to post more of the code’s scope.

@shortbrownman Trying to have multiple file uploads eventually went the Ajax route to get it working but would be good to know how to iterate over them

Are you trying to have unique inputs for each upload or just trying to have one field for multiple uploads? I’m having a hard time seeing why you’d want to do a foreach to get multiple file upload fields. If you could post more of your code’s scope, it’d be helpful. If it’s that you want multiple files on the same field, just append multiple to your field input and cast photos as an array in your component code.

<input wire:model="photos" type="file" multiple>