2

I have tried like below.

{!! Form::file('image',$value=$fileN) !!}

But display an error like below.

ErrorException in FormBuilder.php line 228: Illegal string offset 'name'

Zakaria Acharki
  • 66,747
  • 15
  • 75
  • 101
A.Wen
  • 223
  • 1
  • 5
  • 23

1 Answers1

2

Basically, you can't set the value attribute of a file input, you can create the file input using something like this:

{!! Form::file('image'); !!}

This will create the input. The value will be set when the user will click the input and select a file to upload.

To set up the value of a file input dynamically is not allowed for security reasons and it's not because of Laravel but a general rule. Please check this answer to know more about this.

Community
  • 1
  • 1
The Alpha
  • 143,660
  • 29
  • 287
  • 307