PHP file exists - simple check
PHP file exist : PHP file exist is easily way to check if file exist on server or not. if you are running on website , you need user root directory for proper execution ..
Use below code :
Use below code :
<?php
$file=$_SERVER['DOCUMENT_ROOT']."/images/340x150/audi.jpg";
echo file_exists($file) ;
?>
If file exists on server , it will show you output - 1
if file doesn't exists on server, result will null
Please note below script may not work- avoid to use direct URL. Use only root directory.
echo file_exists("http://autoindianews.com/images/340x150/audi.jpg") ;
Subscribe to:
Posts
(
Atom
)
No comments :
Post a comment