Page 1 of 1

Creating a Folder

Posted: Mon Sep 24, 2007 11:37 pm
by iknownothing
Hey Guys,

I have the following code:

Code: Select all

$checkfile = "../" . $catName . "/" . $sectName;
if (!file_exists($checkfile)) {
	mkdir($checkfile, 0777);
}
What I need to happen is, if it doesn't find the $sectName folder within the $catName folder, it should then create the $sectName folder.

All well in theory, but I get the feeling that the mkdir and file_exists functions, do not use "../" to access one level up. I keep getting "No Such file or directory" errors when using this code.

Also, the $catName folder will always exist, if that matters.


Is there anything I can do to fix the problem?

Thanks.

Posted: Mon Sep 24, 2007 11:52 pm
by feyd
Are you sure you are referencing $catName correctly? You can check with getcwd().

Posted: Tue Sep 25, 2007 9:58 am
by pickle
You're not making a $sectName folder, you're making a $checkfile directory.