CodeIgniter Forums
$username folder - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: $username folder (/showthread.php?tid=19430)



$username folder - El Forum - 06-07-2009

[eluser]Unknown[/eluser]
Hello, Im trying to add a function that creates a folder based on th e$username
I declared the function $username
then I used mkdir($username);
it doesnt create it
it says mkdir function error
or it goes to a blank page and doesnt create the folder


$username folder - El Forum - 06-07-2009

[eluser]TheFuzzy0ne[/eluser]
You should really provide the absolute path that you want to create the directory in.

Code:
mkdir('/home/dotpag/htdocs/users/'.$username);

I'd also suggest some validation to ensure that $username is a valid file name to use with the file system.


$username folder - El Forum - 06-07-2009

[eluser]Unknown[/eluser]
Im going to try it right now I ll get back at you
thank you

can I use base_url ?


$username folder - El Forum - 06-07-2009

[eluser]Unknown[/eluser]
A PHP Error was encountered

Severity: Warning

Message: mkdir() [function.mkdir]: File exists

Filename: controllers/auth.php

I checked the file doesnt exist
this is the code i used :
$username = $this->dx_auth->get_username();
mkdir('/home/www/site.com/users/'.$username);


$username folder - El Forum - 06-07-2009

[eluser]Unknown[/eluser]
nvm I figured it out, $username wasnt declared at that level
so it was trying to create the folder users that already existed thats why it kept giving me those errors
Thanks again!