Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

if folder exists

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

if folder exists

Postby jasonfarrell » Tue Jul 15, 2003 5:15 pm

how would i do this
if (file_exists($myfile)) {$truuu='"true"';} else{$truuu='"false"';}

but instead of if a file exists, a folder exists.
jasonfarrell
New php-forum User
New php-forum User
 
Posts: 4
Joined: Thu Jul 10, 2003 11:34 am

Postby swirlee » Tue Jul 15, 2003 6:21 pm

As far as PHP is concerned, a folder is just another file. So file_exists() should work fine, but if you want to make sure it's a directory, use is_dir().

I don't know that I'll ever forgive Apple for obfuscating the directory/folder concept. Of course, the folder model makes more sense, but I'm still bitter.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 8 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron