Welcome Guest, Not a member yet? Register   Sign In
$username folder
#1

[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
#2

[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.
#3

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

can I use base_url ?
#4

[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);
#5

[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!




Theme © iAndrew 2016 - Forum software by © MyBB