Check to see if a file exists on server.

General discussions related to php

Moderators: macek, egami, gesf

User avatar
tryton
New php-forum User
New php-forum User
Posts: 49
Joined: Wed Jul 09, 2003 8:25 am
Location: Joze
Contact:

Postby tryton » Thu Aug 21, 2003 9:16 am

Try using the fopen statement. For example,

Code: Select all

$fp = fopen("filename", "r");
if($fp) { File exists. } else { File does not exist. }

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Postby Joan Garnet » Thu Aug 21, 2003 10:41 am

There's a specific function for doing that:
http://es.php.net/manual/en/function.file-exists.php

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Re: Check to see if a file exists on server.

Postby swirlee » Thu Aug 21, 2003 11:32 am

danofpaco wrote:Is there a way to check wether or not a file exists on a server, and return a boolean?


Please check the documentation next time.


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest