Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 13th Jul 2015, 10:30 AM   #1
Knowledge is power
War Room Member
 
hometutor's Avatar
 
Join Date: 2004
Location: Honolulu,Hawaii , USA.
Posts: 1,354
Thanks: 406
Thanked 243 Times in 191 Posts
Default
Making a subdirectory php help
Share on: 
fb share twitter share gplus share more share

I found a php code to make a folder on a website. This code words for that, but what I really want to make are subfolders of yourpages

yourpages/hometutor making the full path http://godsbusinessway.com/yourpages/.$var

Here's the code I found which will also write to the generated folder


<?php

// change the name below for the folder you want
$dir = "yourpages";

$file_to_write = 'test.txt';
$content_to_write = "The content";

if( is_dir($dir) === false )
{
mkdir($dir);
}

$file = fopen($dir . '/' . $file_to_write,"w");

// a different way to write content into
// fwrite($file,"Hello World.");

fwrite($file, $content_to_write);

// closes the file
fclose($file);

// this will show the created file from the created folder on screen
include $dir . '/' . $file_to_write;

?>

Thanks,

Rick

hometutor is offline  
Unread 13th Jul 2015, 11:48 AM   #2
VIP Warrior
War Room Member
 
Join Date: 2006
Location: , , USA.
Posts: 1,795
Thanks: 70
Thanked 287 Times in 259 Posts
Default
Re: Making a subdirectory php help
Share on: 
fb share twitter share gplus share more share

mkdir($dir.'/'.$var);
KirkMcD is offline  
The Following User Says Thank You to KirkMcD For This Useful Post:
Unread 14th Jul 2015, 11:20 AM   #3
Knowledge is power
War Room Member
 
hometutor's Avatar
 
Join Date: 2004
Location: Honolulu,Hawaii , USA.
Posts: 1,354
Thanks: 406
Thanked 243 Times in 191 Posts
Default
Re: Making a subdirectory php help
Share on: 
fb share twitter share gplus share more share

Grrrr can't get this to make a subfolder


<?php

// change the name below for the folder you want
$dir = "yourpages";

$affiliate='hometutor';

$file_to_write = 'test.txt';
$content_to_write = "The content ".$dir;

////if( is_dir($dir.'/'.$affiliate) === false )
////{
mkdir($dir.'/'.$affiliate);

//echo $dir;
////}

////$file = fopen($dir . '/' . $file_to_write,"w");

// a different way to write content into
// fwrite($file,"Hello World.");

////fwrite($file, $content_to_write);

// closes the file
fclose($file);

// this will show the created file from the created folder on screen
include $dir . '/' . $file_to_write;

?>

hometutor is offline  
Unread 14th Jul 2015, 11:46 AM   #4
VIP Warrior
War Room Member
 
Join Date: 2006
Location: , , USA.
Posts: 1,795
Thanks: 70
Thanked 287 Times in 259 Posts
Default
Re: Making a subdirectory php help
Share on: 
fb share twitter share gplus share more share

Did you set the rights to create a folder in that directory?
What directory is your script running from?
You might need to put a "./" in front of the base directory.
KirkMcD is offline  
Unread 14th Jul 2015, 03:02 PM   #5
Knowledge is power
War Room Member
 
hometutor's Avatar
 
Join Date: 2004
Location: Honolulu,Hawaii , USA.
Posts: 1,354
Thanks: 406
Thanked 243 Times in 191 Posts
Default
Re: Making a subdirectory php help
Share on: 
fb share twitter share gplus share more share

Originally Posted by KirkMcD View Post

Did you set the rights to create a folder in that directory?
What directory is your script running from?
You might need to put a "./" in front of the base directory.
No, but it worked without the subfolder. I'll try your suggestion.

The php is in godsbusinessway.com/auto

I'm trying to make godsbusinessway.com/youpages/hometutor

yourpages already exists

Rick

hometutor is offline  
Unread 15th Jul 2015, 04:38 AM   #6
VIP Warrior
War Room Member
 
Join Date: 2006
Location: , , USA.
Posts: 1,795
Thanks: 70
Thanked 287 Times in 259 Posts
Default
Re: Making a subdirectory php help
Share on: 
fb share twitter share gplus share more share

Originally Posted by hometutor View Post

The php is in godsbusinessway.com/auto

I'm trying to make godsbusinessway.com/youpages/hometutor
Try using "../" instead of "./" then.
KirkMcD is offline  
The Following User Says Thank You to KirkMcD For This Useful Post:
Unread 15th Jul 2015, 10:13 AM   #7
Knowledge is power
War Room Member
 
hometutor's Avatar
 
Join Date: 2004
Location: Honolulu,Hawaii , USA.
Posts: 1,354
Thanks: 406
Thanked 243 Times in 191 Posts
Default
Re: Making a subdirectory php help
Share on: 
fb share twitter share gplus share more share

Originally Posted by KirkMcD View Post

Try using "../" instead of "./" then.
../ did it thank you

Rick

hometutor is offline  
Closed Thread


Bookmarks

Tags
making, php, subdirectory


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 02:41 PM.