corillo181 Posted December 6, 2006 Share Posted December 6, 2006 is there a way to do a code that would make a directory with a name given?..and a way to make a page with a name given also? Link to comment https://forums.phpfreaks.com/topic/29615-can-i-create-a-directory/ Share on other sites More sharing options...
drifter Posted December 6, 2006 Share Posted December 6, 2006 mkdir($name,0777)fopen() will create one if the dir has permissions and the file does not exist.go to php.net Link to comment https://forums.phpfreaks.com/topic/29615-can-i-create-a-directory/#findComment-135904 Share on other sites More sharing options...
corillo181 Posted December 6, 2006 Author Share Posted December 6, 2006 ok i reading it, and when i make a directory if i want to make a page to write to it i need to put the w, but if i got a bunch of code that i want to dump in to the page that is been made how do i send it to the page? Link to comment https://forums.phpfreaks.com/topic/29615-can-i-create-a-directory/#findComment-135917 Share on other sites More sharing options...
drifter Posted December 6, 2006 Share Posted December 6, 2006 fwrite() Link to comment https://forums.phpfreaks.com/topic/29615-can-i-create-a-directory/#findComment-135922 Share on other sites More sharing options...
corillo181 Posted December 8, 2006 Author Share Posted December 8, 2006 i could create the new directory, but when i try to create a new page it makes it a directory any ways . this is what i tried.[code=php:0]<?php$do=rmdir("sing/index.php",0777);if($do){echo "done";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/29615-can-i-create-a-directory/#findComment-137342 Share on other sites More sharing options...
trq Posted December 8, 2006 Share Posted December 8, 2006 [url=http://php.net/rmdir]rmdir[/url]() (which you have used) removes a directory. [url=http://php.net/rmdir]mkdir[/url]() makes a directory NOT a file. [url=http://php.net/fopen]fopen[/url]() and [url=http://php.net/fwrite]fwrite[/url]() will create a file and write to it. Link to comment https://forums.phpfreaks.com/topic/29615-can-i-create-a-directory/#findComment-137345 Share on other sites More sharing options...
corillo181 Posted December 9, 2006 Author Share Posted December 9, 2006 i trie dthis and it didn't work[code]<?php$do=fopen("sing/index.php",'x');$filepath= 'sing/index.php';$write='this is all shit man';if($do){fwrite($filepath, $write);}?>[/code] Link to comment https://forums.phpfreaks.com/topic/29615-can-i-create-a-directory/#findComment-137952 Share on other sites More sharing options...
bljepp69 Posted December 9, 2006 Share Posted December 9, 2006 Needs to be:[code]<?php$do=fopen("sing/index.php",'x');$filepath= 'sing/index.php';//don't need this$write='this is all shit man';if($do){fwrite($do, $write);}fclose($do);?>[/code] Link to comment https://forums.phpfreaks.com/topic/29615-can-i-create-a-directory/#findComment-137953 Share on other sites More sharing options...
corillo181 Posted December 9, 2006 Author Share Posted December 9, 2006 it still doesn't write nothing to the directory ..[code]<?php$do=fopen("sing/index.php",'r');$write='this is all it man';if($do){fwrite($do, $write);}fclose($do);?>[/code] Link to comment https://forums.phpfreaks.com/topic/29615-can-i-create-a-directory/#findComment-138071 Share on other sites More sharing options...
corillo181 Posted December 9, 2006 Author Share Posted December 9, 2006 oh ok i had to use fopen'w' not 'r', but what if i want to throw a whole page full of code do i have to attach it to a variable too ? Link to comment https://forums.phpfreaks.com/topic/29615-can-i-create-a-directory/#findComment-138079 Share on other sites More sharing options...
corillo181 Posted December 10, 2006 Author Share Posted December 10, 2006 can't dumb one page into another? Link to comment https://forums.phpfreaks.com/topic/29615-can-i-create-a-directory/#findComment-138325 Share on other sites More sharing options...
trq Posted December 10, 2006 Share Posted December 10, 2006 [quote]but what if i want to throw a whole page full of code do i have to attach it to a variable too[/quote]Yes. You'll need to put it into a variable.[quote]can't dumb one page into another?[/quote]You can copy a file. Link to comment https://forums.phpfreaks.com/topic/29615-can-i-create-a-directory/#findComment-138357 Share on other sites More sharing options...
corillo181 Posted December 10, 2006 Author Share Posted December 10, 2006 would something like this work[code]<?php$do=fopen("sing/index.php",'w');$write=fopen("htmlforms/join_form.html",'r');if($do){fwrite($do, $write);}fclose($do);?>[/code] Link to comment https://forums.phpfreaks.com/topic/29615-can-i-create-a-directory/#findComment-138401 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.