I have some image files in public/image directory, so I want to determine if a file exist in that directory before I save a new file. How to determine if a file exist?
I have some image files in public/image directory, so I want to determine if a file exist in that directory before I save a new file. How to determine if a file exist?
file_exists(public_path($name)
here is my solution to check if file exists before downloading file.
if (file_exists(public_path($name)))
return response()->download(public_path($name));