Jump to content


Creating folders and copying files

  • Please log in to reply
No replies to this topic

#1 lifeasalounge

  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 05 October 2006 - 05:39 AM

I am using this 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.'&');

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?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users