Commit ae8f4509 authored by Gudipaty Aniket's avatar Gudipaty Aniket

modified newdir.php

parent c032871f
...@@ -2,17 +2,19 @@ ...@@ -2,17 +2,19 @@
$postData = file_get_contents("php://input"); $postData = file_get_contents("php://input");
if(isset($postData) && !empty($postData)) { if(isset($postData) && !empty($postData)) {
$request = json_decode($postData); $request = json_decode($postData, true);
// $username = trim($request->username); $username = $request['username'];
$dirname = trim($request->dirname); $dirname = $request['dir_name'];
$path = trim($request->currdir) . '/' . $dirname; $path = "../users/" . $username . "/" . $request['curr_dir'] . "/" . $dirname;
if(file_exists($path)) { if(file_exists($path)) {
$msg = "directory already exists"; $msg = "directory already exists";
clearstatcache(); clearstatcache();
echo json_encode($msg); echo json_encode($msg);
} }
else { else {
mkdir($path); mkdir($path, 0777, true);
echo json_encode("Success");
clearstatcache(); clearstatcache();
} }
......
...@@ -25,7 +25,7 @@ if (isset($postData) && !empty($postData)) { ...@@ -25,7 +25,7 @@ if (isset($postData) && !empty($postData)) {
'id' => mysqli_insert_id($mysqli), 'id' => mysqli_insert_id($mysqli),
'username' => $username 'username' => $username
]; ];
mkdir('../users/' . $authData['username'], 0755, true); mkdir('../users/' . $authData['username'], 0777, true);
$mysqli->query($sql1); $mysqli->query($sql1);
echo json_encode($authData); echo json_encode($authData);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment