PHP - Check if a file exists


SUBMITTED BY: efbee

DATE: Oct. 3, 2016, 3:59 p.m.

FORMAT: PHP

SIZE: 190 Bytes

HITS: 782

  1. Check a file exists
  2. <?php
  3. $filename = 'test.csv';
  4. if (file_exists($filename))
  5. {
  6. print "The file $filename exists";
  7. }
  8. else
  9. {
  10. print "The file $filename does not exist";
  11. }
  12. ?>

comments powered by Disqus