mirror of
https://github.com/danpros/htmly.git
synced 2026-04-20 04:26:22 +05:30
Refactor "if" condition for "$_FILES" array
remove unnecessary nested if condition to one liner using AND Boolean operator.
This commit is contained in:
parent
ee3e479ebd
commit
faa522d827
1 changed files with 18 additions and 20 deletions
|
|
@ -26,8 +26,7 @@ if (login()) {
|
||||||
mkdir($dir, 0755, true);
|
mkdir($dir, 0755, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_FILES)) {
|
if (isset($_FILES) && isset($_FILES['file'])) {
|
||||||
if (isset($_FILES['file'])) {
|
|
||||||
$tmp_name = $_FILES['file']['tmp_name'];
|
$tmp_name = $_FILES['file']['tmp_name'];
|
||||||
$name = basename($_FILES['file']['name']);
|
$name = basename($_FILES['file']['name']);
|
||||||
$error = $_FILES['file']['error'];
|
$error = $_FILES['file']['error'];
|
||||||
|
|
@ -48,7 +47,6 @@ if (login()) {
|
||||||
$error = "File is not an image.";
|
$error = "File is not an image.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
'path' => $path,
|
'path' => $path,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue