Jquery Ajax

the ajax request

```
$.ajax({
                    type: 'POST',
                    url: 'Enviar_Solicitud',
                    data: {
                        'nombres': $('input[name=ModTextNombres]').val(),
                        'email': $('input[name=ModTextEmail]').val(),
                        'categoria': $('select[name=ModSelctCategoria]').val(),
                        'descripcion': $('textarea[name=ModTextAreaDescripcion]').val(),
                        'referencia': $('input[name=ModFilArchReferencia]').val()
                    },
                    cache: false,
                    success: function (data) {
                        if (data.Success == true) {
                            toastr.success(data.Message);
                        }
                    },
                    error: function (jqXhr) {
                        if (jqXhr.status === 422) {
                            var errors = jqXhr.responseJSON;
                            errorsHtml = '<ul>';
                            $.each(errors , function(key, value) {
                                errorsHtml += '<li>' + value[0] + '</li>';
                            });
                            errorsHtml += '</ul>';
                            toastr.error(errorsHtml);
                        }
                    }
                });

```

Form Blade

the form blade whith the correct files => true

```
<div class="modal-body">
              {!! Form::open(array("class" => "form-horizontal", "name" => "FormEnviarPresupuesto", "role" => "form", "files" => true, "data-toggle" => "validator")) !!}
              <div class="form-group">
                {!! Form::label("LablNombres", "Nombres", array("class" => "col-md-2 control-label")) !!}
                <div class="col-lg-8">
                  {!! Form::text("ModTextNombres", null, array("class" => "form-control input-md", "placeholder" => "Nombres", "pattern" => "[a-zA-ZñÑáéíóúÁÉÍÓÚ\s]+", "required" => "")) !!}
                  <div class="help-block with-errors"></div>
                </div>
              </div>
              <div class="form-group">
                {!! Form::label("LablEmail", "Email", array("class" => "col-md-2 control-label")) !!}
                <div class="col-md-8">
                  {!! Form::email("ModTextEmail", null, array("class" => "form-control input-md", "placeholder" => "ej@dominio.com", "required" => "")) !!}
                  <div class="help-block with-errors"></div>
                </div>
              </div>
              <div class="form-group">
                {!! Form::label("LablCategoria", "Categoría", array("class" => "col-md-2 control-label")) !!}
                <div class="col-lg-8">
                  {!! Form::select("ModSelctCategoria", array("1" => "Nuestro Software", "2" => "Sistema Personalizado", "3" => "Web Auto-Administrable", "4" => "CMS", "5" => "Mantenimiento"), null, array("class" => "form-control", "placeholder" => "Seleccione...")) !!}
                </div>
              </div>
              <div class="form-group">
                {!! Form::label("LablDescripcion", "Descripción", array("class" => "col-md-2 control-label")) !!}
                <div class="col-md-8">
                  {!! Form::textarea("ModTextAreaDescripcion", null, array("class" => "form-control", "rows" => "6", "required" => "")) !!}
                  <div class="help-block with-errors"></div>
                </div>
              </div>
              <div class="form-group">
                {!! Form::label("LablArchReferencia", "Referencia", array("class" => "col-md-2 control-label")) !!}
                <div>
                  {!! Form::file("ModFilArchReferencia", null, array("class" => "input-file")) !!}
                </div>
              </div>
              <div class="form-group text-center">
                {!! Form::button("<i class='fa fa-check fa-lg'></i> Enviar Solicitud", array("class" => "btn btn-lg btn-success", "name" => "BtnEnviarSolicitud", "type" => "submit")) !!}
              </div>
              {!! Form::close() !!}
            </div>

```

Controller

the controller. in laravel 5.0 this work but in this version 5.2 not working because $request->file("referencia") return null

```
namespace App\Http\Controllers;

use Request;
use App\SolicitudModel;
use App\Http\Requests\SolicitudFormRequest;

class SolicitudController extends Controller
{

    public function GuardarSolicitud (SolicitudFormRequest $request)
    {
        if (Request::ajax())
        {
            $_solicitud = new SolicitudModel;
            $_solicitud->nombres = $request->get("nombres");
            $_solicitud->email = $request->get("email");
            $_solicitud->categoria = $request->get("categoria");
            $_solicitud->descripcion = $request->get('descripcion');

            $_solicitud->referencia = $request->file("referencia")->getClientOriginalName();
            $name = $request->file("referencia")->getClientOriginalName();
            $request->file("referencia")->getClientOriginalExtension();
            $request->file("referencia")->move(base_path() . '/public', $name);
            $_solicitud->save();
            return response()->json(["Success" => true]);
        }
    }

}

```