The script below won't work. If the "/oop/newspictures/" directory is empty then the second part of the "else" function creates a directory and copies the text file "PlaceHolder.txt" in the directory. That part works just fine.
The problem occurs when the directory exists or has been previously created. When the directory and the PlaceHolder.txt file exist or have been created the code snippet below won't print out "That directory already exists" - it simply quits and displays a blank screen in the browser.
I've been grappling with this problem for two or three days. I have tried numerous different techniques and can't get any of them to work.
What I'm wanting to do is, if the directory already exists, to display a notification to the user that the directory already exists - and if the directory does not exist then create the directory.
I would appreciate if anyone could tell me how to write the code snippet so that it will work.
//The variables in the two lines below are taken from above.
$CheckReference = "20030101";
$Admin[Directory] = "/oop/newspictures/$CheckReference";
//--------------
}else{
$File == "/oop/newspictures/$CheckReference/PlaceHolder.txt";
if ($File){
echo "That directory already exists.";
}else{
$DirectoryName ="$Admin[Directory]";
$DirectoryMade = mkdir($DirectoryName, 0777);
$PlaceHolder = "PlaceHolder.txt";
copy($PlaceHolder, "/oop/newspictures/$CheckReference/PlaceHolder.txt");
$UploadPictureForm = "<form> bla bla .. Upload Form bla bla </form>\n";
}
echo $UploadPictureForm;
}
//-------------
Thanks.
Volitics