I get this message:
The foto ktp must be an image.
The foto ktp must be a file of type: jpg, jpeg, png.
The foto profile must be an image.
The foto profile must be a file of type: jpg, jpeg, png.
I wonder why it does not pass the validation test?
I already uploaded a jpg & jpeg file and they are images. I uploaded 180 KB jpeg & 30 KB jpg files.
SellerController.php
public function add(Request $request)
{
$this->validate($request, [
'no_ktp' => 'required|numeric',
'foto_ktp' => 'required|image|mimes:jpg,jpeg,png|max:10000',
'foto_profile' => 'required|image|mimes:jpg,jpeg,png|max:10000'
]);
$original_name_ktp = $request->file('foto_ktp')->getClientOriginalName();
$original_name_profile = $request->file('foto_profile')->getClientOriginalName();
$request->file('foto_ktp')->storeAs(null, $original_name_ktp, 'foto_ktp');
$request->file('foto_profile')->storeAs(null, $original_name_profile, 'foto_profile');
session()->flash('flash', 'Thank you, your registration completed');
return redirect('/seller');
}
seller.blade.php
@include('layouts.errors')
@include('layouts.flash')
@include('layouts.errors_html')
<form action="{{ url('/daftarseller') }}" method="get" enctype="multipart/form-data">
<div id="box">
<hr>
<div id="langkah">LANGKAH 1</div>
<hr><br>
Masukkan No. KTP <input class="effect" name="no_ktp" type="textbox" placeholder="No. KTP" size="20"><br>
<br><br>
</div>
<div id="box2">
<hr>
<div id="langkah">LANGKAH 2</div>
<hr><br>
Foto diri beserta KTP Anda.<br>
Nomor KTP dan Wajah Anda harus terlihat jelas<br>
dalam foto.<br><br>
<div id="upload">
<br>
<div class="col-sm-6 col-xs-6">
<img src="images/reg/upload_foto.jpg" width="150">
<input type="file" class="foto_upload" name="foto_profile" accept="image/png,image/jpeg" required></div>
<div class="col-sm-6 col-xs-6">
<img src="images/reg/upload_ktp.jpg" width="150">
<input type="file" class="ktp_upload" name="foto_ktp" accept="image/png,image/jpeg" required></div>
<div class="col-sm-6 col-xs-6">Tambahkan Foto Anda</div>
<div class="col-sm-6 col-xs-6">Tambahkan Foto KTP Anda</div>
</div>
</div>
<br><br><br><br>
<div id="box3"><br>
<input type="checkbox" name="vehicle" value="Bike"> Saya setuju dengan <a href="https://shopee.co.id/docs/3000" target="_blank">Syarat & Ketentuan</a> program Penjual Terpilih Shopee.<br>
</div>
<br><br>
<div id="box4"><br>
<img src="images/reg/btn_kirim.jpg" width="300">
<input type="submit" value="Submit">
</div>
</form>