<form action="{{ url('/daftarseller') }}" enctype="multipart/form-data">
And you need to check that it isn't null.
Hello,
I am trying to create upload image form:
seller.blade.php
<form action="{{ url('/daftarseller') }}">
<div id="upload">
KTP:
<input type="file" class="form-control" name="foto_profile" accept="image/png,image/jpeg" required><br>
Profile:
<input type="file" class="form-control" name="foto_ktp" accept="image/png,image/jpeg" required>
<br>
<input type="submit" value="Submit">
</form>
SellerController.php
public function add(Request $request)
{
$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_ktp, 'foto_profile');
}
I get an error on:
$original_name_ktp = $request->file('foto_ktp')->getClientOriginalName();
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Call to a member function getClientOriginalName() on null
I am not sure what it does I basically want to copy the file that upload to the : foto_ktp directory (I already set it up on filesystems.php).
I also need to save the file name of the picture. Please help make this works.
In xampp, set up your development correctly following this guide
http://novate.co.uk/deploy-laravel-5-on-shared-hosting-from-heart-internet/
Should look like this https://imgur.com/Oo6k4Fp
Then choose if you want images above public_html(htdocs) or under public_html
It's just good to setup dev env correctly instead of all in one folder under htdocs.
In laravel most store images under storage which is above htdocs. But choice is yours, you can also store in public folder, if non-secure and okay for public to gain access to.
I feel you would benefit from a proper laravel folder structure prior to anything else.
Please or to participate in this conversation.