HDTuto.com

Laravel 6 check file exists in folder example



In this article, i will show you how to check file is exists or not in folder laravel 6 application. we can easily check file is exists or not in directory using File or Storage facade in laravel 6 project. i will give you simple and more solution of laravel 6 check file is available or not from public folder or storage folder.

I will give you more way to check file is exists or not in public folder in laravel 6. you can see i will use File facade to check file is exists or not, Storage facade will use to check file is exists or not in directory from storage in laravel 6 and also i will give you simple code core php to check file is exists or not.

Using File System:

public function checkFile(Request $request)

{

$path = public_path('upload/itsolutionstuff.png');

$isExists = File::exists($path);

dd($isExists);

}

Using Storage System:

public function checkFile()

{

$isExists = Storage::exists('upload/itsolutionstuff.png');

dd($isExists);

}

Using Core PHP:

public function checkFile()

{

$path = public_path('upload/itsolutionstuff.png');

$isExists = file_exists($path);

dd($isExists);

}

It will help you...




September 28, 2019 | Category : LaravelLaravel 6
Related Posts



Blog Search