Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel form not returning input when I add 'files'=>true

I have a form looking like this:

{{ Form::open(array('route' => 'notebook.store', 'files' => true)) }}
{{ Form::text('title', null, [
    'class'=>'form-control',
    'placeholder'=>'Title',
]) }}
<br>
{{ Form::text('description', null, [
    'class'=>'form-control',
    'placeholder' => 'Desc',
])}}
<br>
{{ Form::file('path') }}
<br>

{{ Form::submit('Save', [
    'class' => 'btn btn-primary btn-lg pull-right'
]) }}
<br><br>
{{ Form::close()}}

The problem is that Input::all() in my controller returns an empty array if that 'files'=>true is in the form description, when I remove it, the problem goes away and Input::all() returns the usual, expected input.

Edit- I found out what the problem was. My server had terribly low post_max_size in php.ini, and apparently it clears all your post/get data if the file exceeds that limit.

like image 256
user3555081 Avatar asked Mar 20 '23 20:03

user3555081


1 Answers

Use this:

{{ Form::open(array('route' => 'notebook.store', 'enctype' => 'multipart/form-data')) }}

For any reason this:

{{ Form::open(array('route' => 'notebook.store', 'files' => true)) }}

does not work!

like image 102
Todor Todorov Avatar answered Mar 29 '23 23:03

Todor Todorov