[英]how to put value for laravel collective file input
你好,我有編輯表格,它有3個輸入,兩個是文本,一個是文件輸入,所以它的編輯形式,所以我必須把輸入的值放進去,這樣當有人提交時,它將保存他的更改
問題是,每次您輸入此編輯表單時,都需要您上傳圖片,我希望從數據庫中獲取文件輸入的值,就像兩個文本輸入一樣,我該怎么做?
{!! Form::model($work,['method' => 'PATCH','enctype' =>
'multipart/form-data' ,'files' => true ,'action'=>
['worksgallarey@update_work','id'=>$work->id,]]) !!}
<div class="form-group{{ $errors->has('title') ? ' has-error' :
''}}">
{{Form::label('title', 'Title')}}
{{Form::text('title', $work->title, ['class' => 'form-control
required' , 'placeholder' => 'Enter a title'])}}
</div>
<div class="form-group{{ $errors->has('picture') ? ' has-error' :
''}}">
{!! Form::label('picture') !!}
{!! Form::file('picture')!!}
</div>
<div class="form-group{{ $errors->has('bio') ? ' has-error' : ''}}">
{{Form::label('bio', 'Bio')}}
{{Form::text('bio', $work->bio, ['class' => 'form-control
required', 'placeholder' => 'Write a bio '])}}
</div>
{{Form::submit('submit',['class' => 'btn btn-primary'])}}
這是我的代碼,我嘗試了
<div class="form-group{{ $errors->has('picture') ? ' has-error' :
''}}">
{!! Form::label('picture') !!}
{!! Form::file('picture' , $work->picture )!!}
</div>
但是沒用
從技術上講,您想做的事是不可能的。 這是一項安全措施-瀏覽用戶需要手動選擇要上傳的文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.