dadamssg Posted July 21, 2009 Share Posted July 21, 2009 I want to just do a search to see if a particular file is in a directory. Which function should i use for this? fopen()? I just want it to return false if the file doesn't exist or true if it does so i can write an if statement around it. Thank YOU Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 21, 2009 Share Posted July 21, 2009 http://php.net/is_file http://php.net/file_exists http://php.net/realpath Quote Link to comment Share on other sites More sharing options...
dadamssg Posted July 21, 2009 Author Share Posted July 21, 2009 thanks, i have another question. If a write a php script to upload an image to a directory and the image already exists in that directory(has the same name) will it automatically overwrite it? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 21, 2009 Share Posted July 21, 2009 well...when you upload a file, it get's put in a temporary folder with a unique name...to save the file you need to use http://us3.php.net/move_uploaded_file which, if the file you are moving it to already exists, will overwrite that file Quote Link to comment Share on other sites More sharing options...
dadamssg Posted July 21, 2009 Author Share Posted July 21, 2009 awesome thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.