Aleks Per
Aleks Per

Reputation: 1639

Laravel 5.1 form - 'files' => true

I use Laravel HTML to create form but I have problem, so in creating form I have:

{!! Form::open(['url'=>'vocuhers','files' => 'true','enctype'=>'multipart/form-data']) !!}

    @include('vouchers.form',['submitButtonText'=>'Click to Add New Vocuher'])

{!! Form::close() !!}

But when I see my HTML form in browser there is just:

<form method="POST" action="http://localhost:8888/vouchers" accept-charset="UTF-8">
   <input name="_token" type="hidden" value="dfgdfgdfgdfgdf">

so where is

enctype="multipart/form-data"

which allow me to upload files from form ?

Why I don't get this HTML output:

<form method="POST" action="https://bedbids.com/chats" accept-charset="UTF-8" enctype="multipart/form-data">
  <input name="_token" type="hidden" value="dsfdfgdfgdfgdfg">

What is the problem here exactly ?

Upvotes: 4

Views: 15515

Answers (4)

Munaver Shuheb S
Munaver Shuheb S

Reputation: 1

Change it to like this:

{!! Form::attributes(['enctype'=>"multipart/form-data"])open(['url'=>'vocuhers']) !!}

Upvotes: 0

Mohammad Khan
Mohammad Khan

Reputation: 41

{!! Form::open(['url'=>'vocuhers','files' => 'true','enctype'=>'multipart/form-data']) !!}

change It to

{!! Form::open(['url'=>'vocuhers','files' =>true,'enctype'=>'multipart/form-data']) !!}

as Markinson said

Upvotes: 0

Ravi Hirani
Ravi Hirani

Reputation: 6539

Change url with route as below.

{{!! Form::open(['route'=>'vocuhers','class'=>'your_class','files'=>true]) !!}} 

Upvotes: 2

holland
holland

Reputation: 2182

Your syntax is wrong. The following works for me:

{{Form::open(array('url' => 'your_url', 'method' => 'post', 'files' => true))}}

Upvotes: 7

Related Questions