Ich arbeite an einer Laravel 5.4 App und das Bild, das ich hochladen möchte, wird nicht auf meine Festplatte verschoben. Können Sie mir helfen?Laravel Das Bild konnte nicht hochgeladen werden
Meine Form:
<form class="form-horizontal" role="form" method="POST" action="{{ route('adminPostNews') }}" accept-charset="UTF-8" enctype="multipart/form-data">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('picture') ? ' has-error' : '' }}">
<label for="picture" class="col-md-1 control-label">Photo</label>
<div class="col-md-6">
<input type="file" id="picture" name="picture">
@if ($errors->has('picture'))
<span class="help-block">
<strong>{{ $errors->first('picture') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Ajouter
</button>
</div>
</div>
</form>
Controller:
public function store_actualites(Request $request)
{
$this->validate($request, [
'picture' => 'required|mimes:jpeg']);
if($request->file('picture'))
{
$file = $request->file('picture');
$extension = $file->getClientOriginalExtension();
Storage::disk('news')->put($file->getFilename().'.'.$extension, File::get($file));
}
}
Meine Platte ist in Ordnung, Laravel den Namen der Datei zu geben, aber der Upload wird nicht funktioniert.