Reputation: 11
function makeDirFromDate($path)
{
$date = date('Y-m-d-H-i-s.u');
if (!mkdir($path . '/' . $date, 0, TRUE))
return FALSE;
return TRUE
}
am having troubles making this script run every time I refresh my browser to create another folder that adds a variable. So if I go to domain.com/script/testfolder/create_dir.php and run this file in the folder called create_dir.php it will create another folder within testfolder with the current year month day hour mintue second and microsecond and so on. The problem is I am having troubles on deciphering where I need to put the domain.com/script/testfolder/ to tell it to create the folders in there.
So the exact dirctory path should be domain.com/script/testfolders/ but no matter where i put it (i've tried the two below) neither work
makeDirFromDate('/domain.com/script/testfolders/');
mkdir("/domain.com/script/testfolders/$date")
I have put both of these replacing the top function and i have also put it under the $date by defining $path = but neither seem to work. what am i doing wrong? where do i put /domain.com/script/testfolders/
Upvotes: 0
Views: 59
Reputation: 111
So you want to call domain.com/script/testfolder/create_dir.php and want to create new folder in the same place, right?
Try this one, but handle with caution:
makeDirFromDate(dirname(__FILE__));
Use .htaccess or other solution to deny access to create_dir.php for anyone else but you.
Upvotes: 1