vendredi 3 février 2017

Laravel - Form in modal doesn't pass "file" input values to controller

this is my scenario:I have a modal that contains a form, where there are different input types, included a "file" input. This is my form:

 {!! Form::open(array('url' => $customerModalPostUrl, 'method' => 'post', 'role' => 'form', 'id' => 'modalCustomerForm', 'files' => true)) !!}
    {!! Form::customText('business_name', trans('crud.customer.business_name'), null, ['placeholder' => true, 'formGroupClass' => 'enterprise individualEnterprise col-md-6', 'icon' => '', $disabled]) !!}
    {!! Form::customText('first_name', trans('crud.customer.first_name'), null, ['placeholder' => true, 'formGroupClass' => 'naturalPerson individualEnterprise col-md-6', 'icon' => '', $disabled]) !!}
    {!! Form::customText('middle_name', trans('crud.customer.middle_name'), null, ['placeholder' => true, 'formGroupClass' => 'naturalPerson individualEnterprise col-md-6', 'icon' => '', $disabled]) !!}
    {!! Form::file('document_path', ['style' => 'margin-bottom: 10px;']) !!}
 {!! Form::close() !!}

And, in controller method, I check for fields existence:

public function storeOnly(CustomerNewRequest $request)
{
    if(isset($request["business_name"]))
    {
        //Some stuffs, it works
    }
    if(isset($request["document_path"]))
    {
        //It doesn't enter here!
    }
}

So, my problem is that "file" input values are not passed to controller, but, if I use the same form not including it in a modal, it works like a charm.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kozS1w
via IFTTT

Aucun commentaire:

Enregistrer un commentaire