I want to get a folder created on username of user logged in and then make that folder upload path for files. Can't find a way to do that. Tried something like this but failed. I get a error for mkdir line.
syntax error, unexpected ';', expecting ')'
$username=$_SESIION['user'];
mkdir('./uploads/images/'.$username, 0777);
$upload_path = "./uploads/images/".$username;
Try this code:-
$username=$_SESIION['user'];
mkdir("./uploads/images/$username", 0777, true);
$upload_path = "./uploads/images/$username";
You should also set 'recursive
' flag 'true
' as third argument in mkdir()
function.
Hope it will work for you :)