How to check file is exists or not in PHP?

Share Me
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Today now in post i will show you How to check file is exists or not in PHP? If we need to check any file is exists or not in the folder. Normally we need to check any image is exist or not, or video is exists or not etc. Now in this example i will use file_exists() for determine the file is available or not in the given given path. So if we also need to check then just follow the bellow example:

Example:
if(file_exists('./upload/flower.jpg')){
	print_r('Image is exist.');
}else{
	print_r('Image is not exist.');
}

Read Also : Laravel Favorite System Example

Thanks for read. I hope it help you. For more you can follow us on facebook.

About code chef

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by code chef →