add upload updater file

This commit is contained in:
Haitem 2020-03-11 14:45:42 +01:00
parent 50100fd4c5
commit b05fa3e1ed
2 changed files with 11 additions and 2 deletions

View File

@ -5,6 +5,15 @@ if (isset($_POST) && !empty($_POST)){
$deviceName = $_POST['deviceName'];
$deviceIcon = $_POST['deviceIcon'];
$sleepTime = 0;
if (isset($_FILES['deviceFirmware']) && isset($_FILES['deviceFirmware']['tmp_name']) && $_FILES['deviceFirmware']['tmp_name'] != "") {
$file = $_FILES['deviceFirmware'];
$fileName = (isset ($_POST['deviceMac']) ? $_POST['deviceMac'] . ".bin" : $file['name']);
if (file_exists("./app/updater/" . $fileName)) {
unlink("./app/updater/" . $fileName);
}
copy($file['tmp_name'], "./app/updater/" . $fileName);
}
if (isset($_POST['sleepTime'])) {
$sleepTime = $_POST['sleepTime'];
}

View File

@ -4,7 +4,7 @@
<i class="fa fa-times"></i>
</div>
<h4 class="mb-4"><?php $LANGMNG->echo('t_editDevice'); ?></h4>
<form method="post" action="">
<form method="post" action="" enctype="multipart/form-data">
<input class="input" type="hidden" name="deviceId" value="<?php echo $DEVICEID; ?>">
<?php if ($DEVICE['approved'] != 0) { ?>
<?php if ($DEVICE['userIsAdmin']) { ?>
@ -69,7 +69,7 @@
</div>
<div class="field">
<div class="label">Mac Address:</div>
<input class="input" type="text" name="deviceToken" value="<?php echo $DEVICE['mac']; ?>" disabled>
<input class="input" type="text" name="deviceMac" value="<?php echo $DEVICE['mac']; ?>" disabled>
</div>
<div class="field">
<div class="label">IP:</div>