php - Edit Input File Laravel 5.1 -


i want edit input file when edit form can't update information picture (the path of picture database) have next code in partial new (the partial in path comp.new.form ):

<div class="input-field col s12">   {!!form::text('titulo',null,['class'=>'validate', 'length'=>'25'])!!}   {!!form::label('titulo','titulo')!!} </div> <div class="input-field col s12">   <div class="file-field input-field">       <input class=" file-path validate" type="text"/>        <div class="btn blue darken-4">           <span>noticia</span>           {!!form::file('noticia',['class'=>'blue darken-4'])!!}        </div>   </div> </div> <div class="input-field col s12">   {!!form::text('descripcion',null,['class'=>'validate', 'length'=>'25'])!!}   {!!form::label('descripcion','descripcion')!!} </div> 

i have view create:

{!!form::open(['route'=>'noticia.store', 'method'=>'post'])!!}     @include('comp.new.form.new')     {!!form::submit('publicar',['class'=>'btn blue darken-4'])!!} {!!form::close()!!} 

and view edit:

{!!form::model($new,['route'=>['noticia.update',$new->id], 'method' => 'put'])!!}              @include('comp.new.form.new')      {!!form::submit('actualizar',['class'=>'btn blue darken-4'])!!} {!!form::close()!!}  

into model report have next code:

class report extends model {   use softdeletes;   protected $table = 'reports';    protected $fillable =  ['titulo','descripcion','noticia','institution_id'];   protected $dates = ['deleted_at'];    public function setnoticiaattribute($value)   {      if( ! empty($value))      {          $this->attribute['noticia'] = $value;      }   }  }  

but when try update nothing happens, eliminating method setnoticiaattribute, keeps path achievement select file update , correct ?. thanks

you have include in form attributes enctype = multipart/form-data pass file information

{!!form::open(['route'=>'noticia.store', 'method'=>'post', 'enctype' => 'multipart/form-data'])!!}    @include('comp.new.form.new')    {!!form::submit('publicar',['class'=>'btn blue darken-4'])!!}  {!!form::close()!!} 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -