i am new in laravel and i learn from tutorial about upload files with form, but i got an error like this:
InvalidArgumentException Driver [] is not supported.
here is my form:
{!! Form::open(['url' => 'pengguna', 'files'=> true ]) !!}
<TABLE BORDER="0">
@if($errors->any())
<TR class="form-group ">
@else
<TR class="form-group">
@endif
<TD>
{!! Form::label('foto', 'Foto:') !!}
</TD>
<TD>
{!! Form::file('foto') !!}
@if($errors->has('foto'))
@endif
</TD>
</TR>
</TABLE>
<div class="box-footer">
{!! Form::submit($submitButton, ['class' => 'btn btn-primary']) !!}
</div>
{!!Form::close() !!}
i created my controller store() like this:
$input= $request->all();
if ($request->hasFile('foto')) {
$foto = $request->file('foto');
$ext = $foto->getClientOriginalExtension();
if ($request->file('foto')->isValid()) {
$foto_name = date('YmdHis'). ".$ext";
$upload_path = 'upload/profpict';
$request->file('foto')->store($upload_path, $foto_name);
$input['foto'] = $foto_name;
}
}
$this->validate($request, [
'foto' => 'nullable|image|max:500',
]);
$pengguna = Pengguna::create($input);
return redirect('pengguna');
and i changed my filesystems like this:
'disks' => [
'foto' => [
'driver' => 'local',
'root' => public_path('upload/profpict'),
],
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
i don't know which code is wrong. i've also created a 'foto' in fillable column. please help me
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Gy0zud
via IFTTT
Aucun commentaire:
Enregistrer un commentaire