How to check file is exists or not in PHP?

By Hardik Savani | April 26, 2016 | | 30026 Viewer | Category : PHP


If you need to check file is exixt or not on folder. Normally we require to check image is exist or not, video is exists or not etc. In this example i use file_exists() for determine file is available or not in given path. So if you also need check then follow bellow example:

Example:

if(file_exists('./upload/flower.jpg')){

print_r('Image is exist.');

}else{

print_r('Image is not exist.');

}



Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.