VijayPatial
VijayPatial

Reputation: 11

How to fetch a directory name in php

i have a question that how to get name of a directory that is dynamically created? explanation-: i create a file upload type and one submit button whenever i clicked submit button then directory is created if not exist with logged in username. but file is not stored there because i can't get a name of directory to store that file. i want how to get that name which function is used in php to get name of directory that is created dynamically.

//$image = $_GET['upload'];
$upload = $_POST["submit"];
session_start();
$_SESSION['x'] = "username";
$path = "upload/";
$image_name = $_FILES["upload"]["name"];
$temp = $_FILES["upload"]["tmp_name"];
if(isset($upload)){
mkdir($path.$_SESSION['x']);
$new = ""//what function I used here to fetch the name of directory in last step
move_uploaded_file($temp,$new.$image_name);
}

Upvotes: 0

Views: 125

Answers (1)

SLaks
SLaks

Reputation: 887453

The directory name is $path.$_SESSION['x'].

Upvotes: 1

Related Questions