I just want to ask if it's possible to create a folder where the name of the folder will start on a session? I tried this: mkdir($_SESSION['user_id'] . "/testing/");
and if it is possible, can you help me how? I'm just a newbie. Thanks!
Yes its possible. You can use mkdir() function with recursive parameters to achieve the goal:
<?php
session_start();
$_SESSION['id'] = 123;
if(isset($_SESSION['id'])) {
if(!@mkdir($_SESSION['id'] . '/test/', 0777, true)) {
echo "Dicectory cannot be created";
};
}
?>
Read here how it works.
Yes its possible. following is the example.
ini_set('display_errors', 'On'); // display error if occurs any mkdir(realpath(dirname(__FILE__)).'/'.$_SESSION['user_id']."/testing/",0777, true); // realpath(dirname(__FILE__)) gives path to you project directory