mahirharoon 0 Report post Posted December 15, 2007 (edited) edit:sorry for the mistake it is php not htmland its with not whithmy code checking script= <?php$file = '$CHECK';if (file_exists($file)) { echo "The file $filename exists";} else { echo "The file $filename does not exist";}?>my question is how to check the file whith htmlexample:on a page a text box is provided and a buttonthe user writes a file name (or website)the user clicks on the submit buttonthen it checks and show it (with the code above)i got the code<?php$filename=$_POST['check'];if (file_exists($filename)) { echo "The file $filename exists";} else { echo "The file $filename does not exist";}?> <form method="post"><input name="check"><input type="submit" /></form> but......the problem is , it will first show$_POST['check']orNotice: Undefined index: check in path\to\filecheck.php on line 2The file does not exist Edited December 15, 2007 by mahirharoon (see edit history) Share this post Link to post Share on other sites
galexcd 0 Report post Posted December 18, 2007 You can tell php to hide errors such as this if you put an at symbol (@) before the function returning the error.i.e. if(@file_exists($filename)){ Share this post Link to post Share on other sites
mahirharoon 0 Report post Posted December 22, 2007 (edited) thanks alex the programmer i used it for my project <?php$filename=$_POST['check'];if (@file_exists($filename)) { echo "The file $filename exists";} else { echo "The file $filename does not exist , and the non existing file is created"; fopen("$filename", "a+");}?> <form method="post"><input name="check"><input type="submit" /></form>now it checks whether it i there and makes one if not existing Edited December 22, 2007 by mahirharoon (see edit history) Share this post Link to post Share on other sites