Checking That a File Exists : File Open : File Directory PHP Source Code


PHP Source Code » File Directory » File Open »

 

Checking That a File Exists




<?php
  $myfile = "./test.txt";
  if (file_exists ($myfile)){
    $msg="File already exists. ";
  }else{
    $myfile = @fopen ($myfile, "w+"or die ("Couldn't create the file"  );
    $msg= "File created! " ;
    fclose ($myfile);
  }
  echo "$msg"
?>
           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo File Directory
» File Open