Commit 4696afd6 authored by Paarth's avatar Paarth

minor

parent bf95b9eb
...@@ -18,7 +18,6 @@ if (isset($postData) && !empty($postData)) { ...@@ -18,7 +18,6 @@ if (isset($postData) && !empty($postData)) {
mysqli_query($mysqli,$sql); mysqli_query($mysqli,$sql);
$msg = "file successfully deleted"; $msg = "file successfully deleted";
echo json_encode($msg); echo json_encode($msg);
} }
else{ else{
http_response_code(404); http_response_code(404);
......
...@@ -11,34 +11,45 @@ if (isset($postData) && !empty($postData)) { ...@@ -11,34 +11,45 @@ if (isset($postData) && !empty($postData)) {
$lang = trim($request->language); $lang = trim($request->language);
$path = '../users/' . $username . '/' . trim($request->path) . '/' . $filename . $lang; $path = '../users/' . $username . '/' . trim($request->path) . '/' . $filename . $lang;
// if (file_exists($path)) { if (file_exists($path)) {
// $msg = "file already exists"; $msg = "file already exists";
// clearstatcache(); clearstatcache();
// echo json_encode($msg); echo json_encode($msg);
// } }
// else { else {
// $sql1 = "SELECT n_files from userdata where username = $username"; $sql1 = "SELECT n_files from user where username = $username";
// $sql2 = "UPDATE userdata SET n_files = n_files+1 WHERE username = $username "; $sql2 = "UPDATE user SET n_files = n_files+1 WHERE username = $username ";
// $result = mysqli_query($mysqli, $sql1); $result = mysqli_query($mysqli, $sql1)->fetch_all()[0];
// if($result == 10){ if(file_exists($path)){
// $msg = "maximum limit(10) reached"; $myfile = fopen($path, "w");
// echo json_encode($msg); fwrite($myfile, $data);
// } fclose($myfile);
// else{
// if($result = mysqli_query($mysqli, $sql2)) { $msg = "file successfully uploaded";
$myfile = fopen($path, "w"); clearstatcache();
fwrite($myfile, $data); echo json_encode($msg);
fclose($myfile); exit;
}
$msg = "file successfully uploaded"; if($result == 10){
clearstatcache(); $msg = "maximum limit(10) reached";
echo json_encode($msg); echo json_encode($msg);
// } }
// else{ else{
// http_response_code(404); if(mysqli_query($mysqli, $sql2)){
// }
// } $myfile = fopen($path, "w");
// } fwrite($myfile, $data);
fclose($myfile);
$msg = "file successfully uploaded";
clearstatcache();
echo json_encode($msg);
}
else{
http_response_code(404);
}
}
}
} }
......
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