Jump to content

Creating folders and copying files


lifeasalounge

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?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.