Jump to content

Archived

This topic is now archived and is closed to further replies.

lifeasalounge

Creating folders and copying files

Recommended Posts

I am using this code:

Code:
if ($result_b) {
$userdir = 'userpages\\'.$username;
$imagedir = 'userpages\\'.$username.'\images';
if (file_exists($userdir)) {
echo 'this directory already exists.';
} else {
$makedir = mkdir($userdir, 777);
$makedirimages = mkdir($imagedir, 777);
copy('defaultfiles\defaultindex.php', $userdir.'\index.php');
if ($makedir) {
echo 'dir created';
} else {
echo 'error creating dir';
}
$idfile = "userpages\\".$username."\userid.txt";
$idfile = fopen($idfile, 'a');
fwrite($idfile, '&userid='.$userid.'&username='.$username.'&');
fclose($idfile);
}
   
}


It works perfectly on my computer. When i uploaded it to my website here on 100webspace, instead of creating a folder inside a folder it create a folder called 'rossmurphy/images' and instead of copying a file inside a folder it chages the file name to 'userpages/rossmurphy/userid.txt' when this should be the directory to the file. Does anyone know how i can fix this? Has anyone had a similar problem?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.