User Contributed Notes: file_exists
ted@3bits.com
16-Sep-1999 05:58
the description of this function should read:
bool file_exists(string filename);
webconnect@aon.at
13-Jan-2000 11:25
Also, ich habe jetzt verstanden, dass man mit diesem Befehl keine URL ueberpruefen kann. Aber ich suche einen genau solchen Befehl fuer eine Suchmaschine. Gibt es so etwas - Bitte e-mail an mich, wenn jemand etwas weiss !
siggma@siggma.net
31-Jan-2000 06:54
My limited knowledge of German combined with my limited knowledge of English, anyhow, I have the same question:
Is there a function to check is a given URL exists. I tried this one, but nope...
ckernan@tibus.net
01-Feb-2000 07:27
Use fopen function to check if a given URL exists. See note added by
chopin@csone.kaist.ac.kr within documentation for fopen for an example.
lnk@wastelan.com
17-Feb-2000 07:23
file_exists does not traverse the include path.
larryo@buffnet.net
25-Feb-2000 06:12
file_exists() also works with directory names - use this instead of is_dir() and is_file() to verify something's existence.
kevin@imssoft.com
22-Mar-2000 02:37
Does php provide a function that supports globbing like
file_exists("f*")? I'm pretty sure it doesn't.
trollboy@defnet.com
17-Apr-2000 03:53
How do I create a blank txt file though? I want to have file_exists chekc for a file and if it doesn't exits, then I want that file created.
21-Apr-2000 03:27
<pre>
if (!file_exists($file) {
$fp = fopen("temp.phtml", "w");
fputs($fp, $entry);
fclose($fp);
copy("temp.phtml", $catgr . "/" . $newfile);
chmod($catgr . "/" . $newfile, 0777);
</pre>
this should create a file with whatever data you want as the body. I've found that sometime the file permission are off, so i'd have to open an empty file which i leave on the server, then copy that file to the newfile, using chmod to set the permission so i can edit it later.
mstoner@psicorps.com
21-Apr-2000 03:28
<pre>
if (!file_exists($newfile) {
$fp = fopen("temp.phtml", "w");
fputs($fp, $entry);
fclose($fp);
copy("temp.phtml",$newfile);
chmod($catgr . "/" . $newfile, 0777);
</pre>
this should create a file with whatever data you want as the body. I've found that sometime the file permission are off, so i'd have to open an empty file which i leave on the server, then copy that file to the newfile, using chmod to set the permission so i can edit it later.
ben@burt.pnpt.com
14-Jul-2000 10:29
is there a way to get a list of files in a directory? (ls) I want to delete any files that aren't in a given database.
saxey777@yahoo.com
17-Jul-2000 04:07
yeah, there's a beautiful way to get the content of a directory (files, dirs etc.)
this is a PHP xommand: readdir();
code example is:
<?
$handle=opendir('.');
echo "files:"; echo " ";
while ($file = readdir($handle)) {
echo "$file"; echo " ";
}
?>